perwin / imfit

Imfit: an open-source astronomical image-fitting program.
www.mpe.mpg.de/~erwin/code/imfit/
GNU General Public License v3.0
33 stars 7 forks source link

MCMC for parameters without bounds forces them to zero #6

Closed cschreib closed 6 years ago

cschreib commented 6 years ago

If a parameter is not given any bound in the input configuration file, the MCMC silently sets the bounds to 0,0, which forces the parameter to remain equal to zero in all generations. I got fooled twice (I was not using bounds for the flux and for the PA, and blindly used the same config file to try the MCMC).

If bounds are a strict requirement, then I suppose an error message should be printed to force the user to specify the missing bounds. But I suppose the MCMC could still work even if no bound is specified; the starting point of the chains could be set to the initial value (the same value for all chains, perhaps with some extra randomness if needed).

perwin commented 6 years ago

Hi Corentin,

Sorry I didn't respond earlier; I was traveling when you opened these issues, and I'll try to get to them in the next couple of days (jet lag permitting...).

Let me check on this particular issue; it sounds like a proper fix would be to require the specification of bounds (or explicit "fixed" parameters), as is the case for fitting with the Differential Evolution solver.

The MCMC code operates by generating initial samples using a Latin hypercube in the subspace of non-fixed parameters; it needs parameter bounds to set the scale of the sampling in the different dimensions.

cschreib commented 6 years ago

This does sound like a good fix to me! I guess the source of the problem in my case was that I used the Levenberg-Marquardt solver for the "best-fit" and tried using the same config file for the MCMC run. Obviously, that does not work well...

perwin commented 6 years ago

I think this is fixed in the latest commit; missing parameter limits should be flagged as an error.

perwin commented 6 years ago

Since this seems to be fixed in the new (v1.6) release, I'm going to close this issue; feel free to re-open it if the problem turns out to be still there.