Skip to content

Commit

Permalink
expose bobyqa hessian
Browse files Browse the repository at this point in the history
  • Loading branch information
joezuntz committed Dec 9, 2024
1 parent 711efc1 commit 33a782c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cosmosis/samplers/maxlike/maxlike_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def run_optimizer(self, inputs):
}
optimizer_result = pybobyqa.solve(likefn, start_vector, **kw)
opt_norm = optimizer_result.x
# bobyqa calls it .hessian but scipy calls it .hess, so copy it here
# if available
if optimizer_result.hessian is not None:
optimizer_result.hess = optimizer_result.hessian
else:
# Use scipy mainimizer instead
optimizer_result = scipy.optimize.minimize(likefn, start_vector, method=self.method,
Expand Down

0 comments on commit 33a782c

Please sign in to comment.