sede-open / Core2Relperm

Core2Relperm project for inverse modelling of core flooding experiments
MIT License
35 stars 7 forks source link

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

Open Ruslan1541 opened 5 months ago

Ruslan1541 commented 5 months ago

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 commented 3 months ago

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