Hi,
I’m trying to do a sample of a string array, incorporating weights for each of the elements of the array. Specifically,
new_name_event = sample(events,Weights(dict_betas_choices[string(new_player)][new_zone][string(new_time)][string(new_loc)][string(new_res)]))
>ERROR:
MethodError: no method matching Weights(::Array{Any,1}, ::Float64)
Closest candidates are:
Weights(!Matched::var"#18#V", ::var"#16#S") where {var"#16#S"<:Real, var"#17#T"<:Real, var"#18#V"<:AbstractArray{var"#17#T",1}} at C:\Users\semed\.julia\packages\StatsBase\ZxhK8\src\weights.jl:13
Weights(::Any) at C:\Users\semed\.julia\packages\StatsBase\ZxhK8\src\weights.jl:16
Stacktrace:
[1] Weights(::Array{Any,1}) at C:\Users\semed\.julia\packages\StatsBase\ZxhK8\src\weights.jl:16
[2] top-level scope at .\In[22]:62
[3] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
Where,
println(events, typeof(events))
>["Shot", "Duel", "Pass"]Array{String,1}
And,
pesos = dict_betas_choices[string(new_player)][new_zone][string(new_time)][string(new_loc)][string(new_res)]
println(pesos, typeof(pesos), typeof(pesos[1]))
>Any[0.00114591, 0.69774462, 0.30110947] Array{Any,1} Float64
I would appreciate if someone could help me.