Here is a MWE
g=Gibbs(NUTS(:u),PG(20, :s))
This single line throws the error
MethodError: no method matching iterate(::Symbol)
Closest candidates are:
iterate(!Matched::Core.SimpleVector) at essentials.jl:603
iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:603
iterate(!Matched::ExponentialBackOff) at error.jl:253
...
Stacktrace:
[1] indexed_iterate(::Symbol, ::Int64) at .\tuple.jl:84
[2] merge(::NamedTuple{(),Tuple{}}, ::Tuple{Symbol}) at .\namedtuple.jl:255
[3] NUTS{Turing.Core.ForwardDiffAD{40},space,metricT} where metricT<:AdvancedHMC.AbstractMetric where space(::Symbol) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:359
[4] NUTS(::Symbol; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:313
[5] NUTS(::Symbol) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:313
[6] top-level scope at In[113]:1
If I change to
g=Gibbs(NUTS(.65,:u),PG(20, :s))
I get the error
MethodError: Cannot `convert` an object of type Float64 to an object of type Symbol
Closest candidates are:
convert(::Type{T}, !Matched::T) where T at essentials.jl:171
Symbol(::Any...) at strings/basic.jl:207
Stacktrace:
[1] merge(::NamedTuple{(),Tuple{}}, ::Tuple{Float64,Symbol}) at .\namedtuple.jl:255
[2] NUTS{Turing.Core.ForwardDiffAD{40},space,metricT} where metricT<:AdvancedHMC.AbstractMetric where space(::Float64, ::Vararg{Any,N} where N) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:359
[3] NUTS(::Float64, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:313
[4] NUTS(::Float64, ::Vararg{Any,N} where N) at C:\Users\Manoj\.julia\packages\Turing\GMBTf\src\inference\hmc.jl:313
[5] top-level scope at In[114]:1
Finally if I change to
g=Gibbs(NUTS(1000,.65,:u),PG(20, :s))
it doesn’t give an error.
Can someone explain to me why I need to explicitly give the parameters to NUTS here? I can get away in sample() with giving NUTS only one parameter. The documentation says I can give no parameters, and it will pick up default values. Also what does the parameter
n_adapts::Int : The number of samples to use with adaptation.
mean? Where can I read about this and understand what I’m setting?