# [Numpy-discussion] automatic differentiation with PyAutoDiff

James Bergstra bergstrj@iro.umontreal...
Thu Jun 14 13:53:43 CDT 2012

On Thu, Jun 14, 2012 at 11:01 AM, Nathaniel Smith <njs@pobox.com> wrote:

>> Indeed that would be great as sympy already has already excellent math
>> expression rendering.
>>
>> An alternative would be to output mathml or something similar that
>> could be understood by the mathjax rendering module of the IPython
>> notebook.
>
> I'd find it quite useful if it could spit out the derivative as Python
> code that I could check and integrate into my source. I often have a
> particular function that I need to optimize in many different
> situations, but would rather not pull in a whole (complex and perhaps
> fragile) bytecode introspection library just to repeatedly recompute
> the same function on every run...
>
> -N

I was hoping to get by with bytecode-> bytecode interface, are there
bytecode -> source tools that could help here?

Otherwise it might be possible to appeal to the symbolic intermediate
representation to produce more legible source.

With regards to "pulling in a whole bytecode introspection library" I
don't really see what you mean. If the issue is that you want some way
to verify that the output function is actually computing the right
thing, then I hear you - that's an issue. If the issue that autodiff
itself is slow, then I'd like to hear more about the application,
because in minimization you usually have to call the function many
times (hundreds) so the autodiff overhead should be relatively small
(I'm not counting Theano's function compilation time here, which still
can be significant... but that's a separate concern.)

- James
--
http://www-etud.iro.umontreal.ca/~bergstrj