Skip to content
b45ch1 edited this page Sep 13, 2010 · 52 revisions

Algopy is a Python module for automatic differentiation of algorithms.
The project is at an early alpha stage and is likely to change.

Main Features

  • Full support for Numpy functions: numpy.exp(), numpy.sin(), numpy.dot(), numpy.outer() etc.
  • Works on scalars and on matrices
  • Saves the computational graph in a vertex list and natively supports plotting of the computational graph with graphviz

Easy Example

An easy example from the unit test. We want to compute the Hessian of the function “fun(x)”:


from numpy import  *
from reverse_mode import *

def test_hessian():
	# defining the function
	A = array([[11., 3.],[3.,17.]])
	def fun(x):
		return 0.5* dot(x, dot(A,x))

	# compute the Hessian
	x = array([3.,7.])
	H = hessian(fun,x)
	print H

	assert prod(H == A)


We aim for full Numpy support, i.e. all algorithms that use elementary Python types (lists, floats) and numpy arrays and array operations as numpy.dot should work out of the box. Numpy.dot already works flawlessly.

Clone this wiki locally