Fitting with emcee works poorly. Poorly enough that claiming to have an emcee "solver" that can be used to solve minimization problems is kind of a disservice to our users. I do not know if there is something wrong with the code that is new to emcee v3, but I suspect this may have actually never worked that well.
As a minimal, complete, example showing the problem, let's look at
https://lmfit.github.io/lmfit-py/examples/example_emcee_Model_interface.html?highlight=emcee
This shows emcee getting a solution: it looks like we're claiming that it works. And the corner plot is cool. But that solution is actually found by starting with the (much, much faster) solution from Nelder-Mead. In fact, that solution is not actually very close to the right answer itself, and emcee does not improve upon the problem stemming from the huge correlation in the double-exponential. If you change that example to have emcee start at the same starting point as Nelder-Mead, the results are much worse. And 100x slower.
I'm perfectly willing to believe that the code in lmfit using emcee has some error that is making it not work as well as it should. I don't see anything obvious, but I'm definitely not an MCMC expert. Some of the code did change for #600 and emcee3. So, suggestions for fixing the code would be most welcome.
Having submitted #600, I can definitely say that "fitting with emcee" takes up quite a bit of code and has been a fair amount of maintenance. So the cost is definitely not zero, and the benefit seems vanishingly small to me. I never use emcee. With ampgo and brute available, I'm not sure anyone should use this.
Is there a compelling reason to retain emcee in lmfit? Can anyone provide an example of fitting with emcee in which it finds a solution that is not derived from another solver or actually improves upon a previous fit result?
And, yes, to be blunt and clear: I would propose we drop emcee unless it can be shown to give correct results.
Fitting with
emceeworks poorly. Poorly enough that claiming to have anemcee"solver" that can be used to solve minimization problems is kind of a disservice to our users. I do not know if there is something wrong with the code that is new toemcee v3, but I suspect this may have actually never worked that well.As a minimal, complete, example showing the problem, let's look at
https://lmfit.github.io/lmfit-py/examples/example_emcee_Model_interface.html?highlight=emcee
This shows
emceegetting a solution: it looks like we're claiming that it works. And thecornerplot is cool. But that solution is actually found by starting with the (much, much faster) solution fromNelder-Mead. In fact, that solution is not actually very close to the right answer itself, andemceedoes not improve upon the problem stemming from the huge correlation in the double-exponential. If you change that example to haveemceestart at the same starting point asNelder-Mead, the results are much worse. And 100x slower.I'm perfectly willing to believe that the code in
lmfitusingemceehas some error that is making it not work as well as it should. I don't see anything obvious, but I'm definitely not an MCMC expert. Some of the code did change for #600 andemcee3. So, suggestions for fixing the code would be most welcome.Having submitted #600, I can definitely say that "fitting with
emcee" takes up quite a bit of code and has been a fair amount of maintenance. So the cost is definitely not zero, and the benefit seems vanishingly small to me. I never useemcee. Withampgoandbruteavailable, I'm not sure anyone should use this.Is there a compelling reason to retain
emceeinlmfit? Can anyone provide an example of fitting withemceein which it finds a solution that is not derived from another solver or actually improves upon a previous fit result?And, yes, to be blunt and clear: I would propose we drop
emceeunless it can be shown to give correct results.