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

Update NumCosmo walkers #436

Closed
combet opened this issue Sep 13, 2021 · 5 comments · Fixed by #615
Closed

Update NumCosmo walkers #436

combet opened this issue Sep 13, 2021 · 5 comments · Fixed by #615
Assignees
Labels
enhancement Tackle this someday but not immediately

Comments

@combet
Copy link
Collaborator

combet commented Sep 13, 2021

From @vitenti - API has slightly changed with the latest conda released of NC (v0.15.4). In NumCosmo examples, e.g. example2...:

Ncm.FitESMCMCWalkerAPS.new (nwalkers, mset3.fparams_len ())
should be replaced by
Ncm.FitESMCMCWalkerAPES.new (nwalkers, mset3.fparams_len ())

Also, with this new version of the sampler, the number of walkers needs to be increase
nwalkers = 100 --> nwalkers=800

@hsinfan1996
Copy link
Collaborator

hsinfan1996 commented Sep 25, 2021

The version number of NC seems to be 1 after NC gets imported. Not sure if it is possible to distinguish between different versions of NC.
Cell 22:

try:
    nwalkers = 100 # Number of walkers
    walker = Ncm.FitESMCMCWalkerAPS.new (nwalkers, mset3.fparams_len ())
except AttributeError:
    nwalkers=800
    walker = Ncm.FitESMCMCWalkerAPES.new (nwalkers, mset3.fparams_len ())

Cell 26:

try:
    nwalkers = 100
    stretch = Ncm.FitESMCMCWalkerAPS.new (nwalkers, mset3.fparams_len ())
except AttributeError:
    nwalkers=800
    stretch = Ncm.FitESMCMCWalkerAPES.new (nwalkers, mset3.fparams_len ())

@hsinfan1996
Copy link
Collaborator

hsinfan1996 commented Oct 4, 2021

@vitenti In Example2, I tested cell 26 with different versions of NC and the results are:
v0.15.3: 100 walkers, ~23 min (10000 steps)
v0.15.4: 800 walkers, ~37 min (16000 steps)

@vitenti
Copy link
Collaborator

vitenti commented Oct 4, 2021

@hsinfan1996 In the lastest version (on github) you can try the old behavior of APES using:

Ncm.FitESMCMCWalkerAPES.new_full (nwalkers, mset.fparams_len (), Ncm.FitESMCMCWalkerAPESMethod.KDE, Ncm.FitESMCMCWalkerAPESKType.CAUCHY, 1.0, True)

I'll be releasing a new version of NumCosmo that includes this possibility in the next days. If you like, you could test using this constructor and 100 walkers to see if the previous results is recovered.

The default method used by apes now is Ncm.FitESMCMCWalkerAPESMethod.VKDE which is more costly but much more powerful to probe complicated posteriors.

@hsinfan1996
Copy link
Collaborator

@hsinfan1996 In the lastest version (on github) you can try the old behavior of APES using:

Ncm.FitESMCMCWalkerAPES.new_full (nwalkers, mset.fparams_len (), Ncm.FitESMCMCWalkerAPESMethod.KDE, Ncm.FitESMCMCWalkerAPESKType.CAUCHY, 1.0, True)

I'll be releasing a new version of NumCosmo that includes this possibility in the next days. If you like, you could test using this constructor and 100 walkers to see if the previous results is recovered.

The default method used by apes now is Ncm.FitESMCMCWalkerAPESMethod.VKDE which is more costly but much more powerful to probe complicated posteriors.

Thanks. It is good that I do not have to switch between different versions now. I am able to install NC from github, and I will get back to you once I finish the tests.

@hsinfan1996
Copy link
Collaborator

hsinfan1996 commented Oct 7, 2021

@vitenti @combet
NC 0.15.4
old method: ~33 min, 14000 moves
new method: same as previous
I am not sure how should I proceed given what I have right now, because I don't know how NC determines how many steps are needed for each MCMC run. It looks like time per step is the same regardless of the algorithms, so the total number of steps is more important.

@marina-ricci marina-ricci added bug Something isn't working enhancement Tackle this someday but not immediately labels May 9, 2022
@hsinfan1996 hsinfan1996 removed the bug Something isn't working label Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Tackle this someday but not immediately
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants