Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_params doesn't work since v0.30.0 #2150

Closed
Batmaev opened this issue Jan 3, 2024 · 4 comments
Closed

init_params doesn't work since v0.30.0 #2150

Batmaev opened this issue Jan 3, 2024 · 4 comments

Comments

@Batmaev
Copy link

Batmaev commented Jan 3, 2024

It seems that the sample function ignores specified initial parameters. I provide them as sample(model, ..., init_params=...).

How to reproduce:

@model function model(y)
    mu ~ Flat()
    y ~ Normal(mu, 0.0001)
end

m = model(-94)

sample(m, NUTS(), 1, init_params = [-94])
# in v0.29.3: correctly outputs single sample with mu = -94
# in v0.30.0: outputs something random e.g. mu = -177.713

This is important because sometimes we have very narrow distribution, and the sampler may get stuck in a region with very low probability. Providing good starting point is the only way to sample something.

P.S. I use macOS and Julia 1.10.0

@devmotion
Copy link
Member

The keyword argument is called initial_params since Turing 0.30.0/DynamicPPL 0.24/AbstractMCMC 5.

@Batmaev
Copy link
Author

Batmaev commented Jan 3, 2024

Thank you very much

@brendanwallison
Copy link

This error message is going to lead people astray (myself included):

┌ Warning: failed to find valid initial parameters in 10 tries; consider providing explicit initial parameters using the init_params keyword └ @ Turing.Inference C:\Users\brend\.julia\packages\Turing\tdsVz\src\mcmc\hmc.jl:171

@devmotion
Copy link
Member

Seems that #2115 is problematic - it added support for AbstractMCMC 5 (without removing support for AbstractMCMC 4 even though the API is incompatible!) and DynamicPPL 0.24 without updating all internals of Turing.jl to initial_params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants