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

DRMNFB does not work #249

Closed
HarveyAdamW opened this issue Sep 12, 2018 · 0 comments
Closed

DRMNFB does not work #249

HarveyAdamW opened this issue Sep 12, 2018 · 0 comments

Comments

@HarveyAdamW
Copy link

Whenever I try to use a non-Minuit (i.e., not MINUIT or NewMinuit) optimizer I receive the error given at the bottom of this comment. The problem seems to be the way that optimization is implemented through pyLikelihood for non-Minuit optimizers. From what I can understand of the documentation, the pyLike.NewMinuit is specifically designed for using the NewMinuit optimizer, and for non-Minuit optimizers the proper thing to do is to pass the logLike object to pyLike.OptimizerFactory.

Testing outside of fermipy reveals that using pyLike.OptimizerFactory results in this error. The Fermi Help Desk suggests for using non-Minuit optimizers to not pass an optObject to like.fit. This could be accomplished with fermipy by simply setting optObject to None in gtanalysis._fit_optimzier if not using MINUIT or NewMinuit. A conditional must also be inserted to prevent gtanalysis._fit_optimizer from attempting to access the optObject.

I have implemented this change in a fork (I've made a pull request for it). It seems to perform properly. This allows optimizers like DRMNFB to be used when MINUIT or NewMinuit will not converge, or to provide the user with starting values for parameters.

In [6]: fit = gta.fit(optimizer = 'DRMNFB')
2018-06-29 13:14:03 INFO GTAnalysis.fit(): Starting fit.
2018-06-29 13:14:07 ERROR GTAnalysis._fit_optimizer(): Likelihood optimization failed.
Traceback (most recent call last):
File "/home/adam/anaconda2/lib/python2.7/site-packages/fermipy/gtanalysis.py", line 2847, in _fit_optimizer
self.like.fit(**kw)
File "/home/adam/Software/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.19-10-w
ithout-root/x86_64-unknown-linux-gnu-libc2.19-10/lib/python/SummedLikelihood.py", line 95, in fit
optObject=optObject)
File "/home/adam/Software/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.19-10-w
ithout-root/x86_64-unknown-linux-gnu-libc2.19-10/lib/python/SummedLikelihood.py", line 185, in _error
s
errors = myOpt.getUncertainty(useBase)
File "/home/adam/Software/ScienceTools-v10r0p5-fssc-20150518-x86_64-unknown-linux-gnu-libc2.19-10-w
ithout-root/x86_64-unknown-linux-gnu-libc2.19-10/lib/python/pyLikelihood.py", line 2107, in getUncert
ainty
return lib_pyLikelihood.Optimizer_getUncertainty(*args)
RuntimeError: Optimizer::choleskyDecompose:
Imaginary diagonal element.
Element value squared = -0

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