You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: