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

MCMC sampling finding very far-off MAP values #331

Open
elmiio opened this issue Apr 15, 2024 · 7 comments
Open

MCMC sampling finding very far-off MAP values #331

elmiio opened this issue Apr 15, 2024 · 7 comments

Comments

@elmiio
Copy link

elmiio commented Apr 15, 2024

Hello,

I have recently run into an issue while modelling using prospector. Essentially, the emcee sampling results in Maximum a Posteriori (MAP) estimations that are very obviously incorrect.

image

In this corner plot, you can see that walker chains have settled on a very small "local maximum" in the mass parameter, despite it very clearly not being the right solution when compared to the rest of the probability distribution. As a result, I obtain a MAP spectrum that is also very clearly far off from the data:

image

I have since been able to avoid this issue by adjusting the prior on my mass parameter, but I am still wondering how the program able to produce such a result in the first place. It may be helpful to know so that I (or anyone else) do not run into a similar issue in the future.

Thank you!
Omar

@bd-j
Copy link
Owner

bd-j commented Apr 28, 2024

Hi,

I'm not sure how you are getting the MAP parameters from the prospector outputs. It is not at all obvious to me that the walker chains "settled" on the blue cross in the corner plots, if that is what you are suggesting is the MAP solution (which I agree is clearly a terrible solution.)

Anyway it should not be possible to have a higher MAP for that solution compared to something that's 7 orders of magnitude brighter like the bulk of the samples, so I wonder if there isn't some issue in how the MAP parameters are being obtained from the posterior chain. More details on how the MAP parameters you're plotting were obtained would be helpful. Thanks!

@elmiio
Copy link
Author

elmiio commented May 22, 2024

Hello,

The MAP parameters that I am plotting (mass, metallicity and age) were found through minimization and MCMC sampling. The initial values used were [1.0e7, -0.5, 5] for the mass, metallicity and age, respectively. The enabled run parameters for the minimization and emcee sampling were the following:

MINIMIZATION:
run_params["dynesty"] = False
run_params["emcee"] = False
run_params["optimize"] = True
run_params["min_method"] = 'lm'
run_params["nmin"] = 5

EMCEE:
run_params["optimize"] = False
run_params["emcee"] = True
run_params["dynesty"] = False
run_params["nwalkers"] = 128
run_params["niter"] = 1024
run_params["nburn"] = [100, 200, 400]

Thank you!

@bd-j
Copy link
Owner

bd-j commented May 22, 2024

Hi @elmiio, thanks for the information. I would still like to know how exactly you are extracting the best fit parameters from the prospector output. If you could post a code snippet that would be great. Thanks.

@elmiio
Copy link
Author

elmiio commented May 22, 2024

image
image
image
image

This is the code used to extract the best fit parameters from the prospector output. I hope this helps.

@bd-j
Copy link
Owner

bd-j commented May 22, 2024

I think these snippets are only missing the last part where you extract a set of parameters from result and plot it in the corner plot as the blue point.

@elmiio
Copy link
Author

elmiio commented May 22, 2024

I've updated my last comment to include what I believe is a snippet of the code you are referring to. Please let me know if there is any additional information needed.

@bd-j
Copy link
Owner

bd-j commented May 22, 2024

Thanks, can you also print the prospector version, theta_max, the maximum of result["lnprobability"], and the value of result["lnprobability"][i, j]?

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