[Numpy-discussion] Calculation of a hessian
Kiko
kikocorreoso at gmail.com
Fri Aug 8 03:31:59 EDT 2014
Hi all,
I am trying to calculate a Hessian. I am using numdifftools for this (
https://pypi.python.org/pypi/Numdifftools).
My question is, is it possible to make it using pure numpy?.
The actual code is like this:
*import numdifftools as nd*
*import numpy as np*
*def log_likelihood(params):*
* sum1 = 0; sum2 = 0*
* mu = params[0]; sigma = params[1]; xi = params[2]*
* for z in data:*
* x = 1 + xi * ((z-mu)/sigma)*
* sum1 += np.log(x)*
* sum2 += x**(-1.0/xi)*
* return -((-len(data) * np.log(sigma)) - (1 + 1/xi)*sum1 - sum2) #
negated so we can use 'minimum'*
*kk = nd.Hessian(log_likelihood)*
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140808/266a6cd3/attachment.html>
More information about the NumPy-Discussion
mailing list