Automatic differentiation (was Re: second-order gradient)
![](https://secure.gravatar.com/avatar/790fd6e3ccfeaf2865c9294d2df0fa3e.jpg?s=120&d=mm&r=g)
Maybe we should focus on writing a decent 'deriv' function then. I know Konrad Hinsen's Scientific had a derivatives package (Scientific.Functions.Derivatives) that implemented automatic differentiation:
That would be great, but wouldn't that be best suited as a utility requiring Sympy? You'll want to take advantage of all sorts of symbolic classes, especially for any source code transformation approach. IMO Hinsen's implementation isn't a very efficient or attractive solution to AD given the great existing C/C++ codes out there. Maybe we should be looking to provide a python interface to an existing open source package such as ADOL-C, but I'm all in favour of a new pure python approach too. What would be perfect is to have a single interface to a python AD package that would support a faster implementation if the user wished to install a C/C++ package, otherwise would default to a pure python equivalent. -Rob
![](https://secure.gravatar.com/avatar/af6c39d6943bd4b0e1fde23161e7bb8c.jpg?s=120&d=mm&r=g)
2008/10/30 Rob Clewley <rob.clewley@gmail.com>:
That would be great, but wouldn't that be best suited as a utility requiring Sympy? You'll want to take advantage of all sorts of symbolic classes, especially for any source code transformation approach. IMO Hinsen's implementation isn't a very efficient or attractive solution to AD given the great existing C/C++ codes out there. Maybe we should be looking to provide a python interface to an existing open source package such as ADOL-C, but I'm all in favour of a new pure python approach too. What would be perfect is to have a single interface to a python AD package that would support a faster implementation if the user wished to install a C/C++ package, otherwise would default to a pure python equivalent.
In your experience, is this functionality enough to start a separate package, or should we try to include it somewhere else? Otherwise we could think of a new SciKit. Regards Stéfan
![](https://secure.gravatar.com/avatar/790fd6e3ccfeaf2865c9294d2df0fa3e.jpg?s=120&d=mm&r=g)
In your experience, is this functionality enough to start a separate package, or should we try to include it somewhere else? Otherwise we could think of a new SciKit.
I confess to knowing no details about scikits so I don't know what the difference really is between a "new package" and a scikit. To do this properly you'd end up with a sizable body of code, and the potential dependency on Sympy would also suggest making it somewhat separate. I'd defer to others on that point, although I don't really see what other package it would naturally fit with because AD has multiple applications. -Rob
![](https://secure.gravatar.com/avatar/4b2341010faf3467957d416f1cb0dfa1.jpg?s=120&d=mm&r=g)
Hi, I just saw this python package : PyDX which may answer your needs. The original URL is not working, but the svn location exists. http://gr.anu.edu.au/svn/people/sdburton/pydx/doc/user-guide.html svn co http://gr.anu.edu.au/svn/people/sdburton/pydx br -osman
![](https://secure.gravatar.com/avatar/c06db480a0933dd214428df769cbdb02.jpg?s=120&d=mm&r=g)
There are several possibilities, some of them are listed on http://en.wikipedia.org/wiki/Automatic_differentiation == pycppad http://www.seanet.com/~bradbell/pycppad/index.xml pycppad is a wrapper of the C++ library CppAD ( http://www.coin-or.org/CppAD/ ) the wrapper can do up to second order derivatives very efficiently in the so-called reverse mode of AD requires boost::python == pyadolc http://github.com/b45ch1/pyadolc which is a wrapper for the C++ library ADOL-C ( http://www.math.tu-dresden.de/~adol-c/ ) this can do abritrary degree of derivatives and works quite well with numpy, i.e. you can work with numpy arrays also quite efficient in the so-called reverse mode of AD requires boost::python == ScientificPython http://dirac.cnrs-orleans.fr/ScientificPython/ScientificPythonManual/ can provide first order derivatives. But as far as I understand only first order derivatives of functions f: R -> R and only in the usually not so efficient forward mode of AD pure python == Algopy http://github.com/b45ch1/algopy/tree/master pure python, arbitrary derivatives in forward and reverse mode still quite experimental. Offers also the possibility to differentiate functions that make heavy use of matrix operations. == sympy this is not automatic differentiation but symbolic differentiation but is sometimes useful hope that helps, Sebastian On Wed, Mar 11, 2009 at 4:13 AM, Osman <osman@fuse.net> wrote:
Hi,
I just saw this python package : PyDX which may answer your needs. The original URL is not working, but the svn location exists.
http://gr.anu.edu.au/svn/people/sdburton/pydx/doc/user-guide.html
svn co http://gr.anu.edu.au/svn/people/sdburton/pydx
br -osman
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (4)
-
Osman
-
Rob Clewley
-
Sebastian Walter
-
Stéfan van der Walt