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

Error with using using emcee through the minimizer interface in lmfit for Markov-chain Monte Carlo #2

Open
Ruslan1541 opened this issue Apr 9, 2024 · 1 comment

Comments

@Ruslan1541
Copy link

Hello!

I get an error when I use emcee to minimize the mismatch:
IndexError: index -1 is out of bounds for axis 0 with size 0
but I also see that in "example_Fig17_USS_dpw%2Bdpo%2BSwz_bumpfloods.ipynb" when I tried to replace:
result_pckr = Minimizer(uss_matchobj, params_pckr ).least_squares(diff_step=1e-4, verbose=2)
on this:
result_pckr = Minimizer(uss_matchobj, params_pckr, nan_policy=’omit’ ).emcee(steps=20000, burn=300, thin=20, is_weighted=True)
i also get the same error.
Could you please explain the details of your MCMC implementation in inverse modeling, or maybe you know why this problem occurs?

Best regards, Ruslan

@steffenbergshell
Copy link
Collaborator

Dear Ruslan,
somehow I don't get the index error that you mentioned (I ran "example_Fig17_USS_dpw%2Bdpo%2BSwz_bumpfloods.ipynb" with the emcee minimizer).
But there is another error "ValueError: initial state has a large condition number. Make sure that your walkers are linearly independent for the best performance ..". This has to do with the way how the whole problem is formulated, initial guess, fixed parameters etc.
One can skip the initial state check using

result_pckr = Minimizer(uss_matchobj, params_pckr, nan_policy='omit').emcee(steps=20000, burn=300, thin=20, is_weighted=True, progress=True, run_mcmc_kwargs={'skip_initial_state_check':True})

Using that, on my system the solver runs through, producing very similar output for cell #15. There are some errors later on i.e. when computing uncertainty ranges etc. which I would need to check, but on my system in principle the code runs.

Could you please check if on your system the code runs with the line above? If not, perhaps use the environment file to reproduce the same versions of the libraries ?

-Steffen

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

2 participants