简体   繁体   中英

Is it possible to get the hessian through a gamma function in theano?

b=T.fvector()
theano.gradient.hessian( T.gammaln(b).sum(), [b] )

gives an unnamed NotImplementedError . Since the equivalent code works fine with eg T.log instead of T.gammaln I guess theano just doesn't know the second derivation of gammaln ?

The grad of gammaln use psi. But we didn't implement the grad of psi.

You can implement the method grad() of the class Psi in the file theano/scalar/basic_scipy.py. This would make this case work.

This page of the documentation explain how to add a new Op in Theano and explain how to implement the grad() method: http://deeplearning.net/software/theano/extending/extending_theano.html

If you need help implementing this, using theano-dev mailing list is better suited then stackoverflow for ongoing discussion.

If you do it, it would be a great contribution to Theano.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM