comparison doc/v2_planning/API_optimization.txt @ 1188:073c2fab7bcd

fix rst syntax.
author Frederic Bastien <nouiz@nouiz.org>
date Fri, 17 Sep 2010 20:24:30 -0400
parents 4ea46ef9822a
children 886db9dad2f9
comparison
equal deleted inserted replaced
1187:7d34edde029d 1188:073c2fab7bcd
30 30
31 The theano interface to optimization algorithms is to ask for a dictionary of 31 The theano interface to optimization algorithms is to ask for a dictionary of
32 updates that can be used in theano.function. Implementations of iterative 32 updates that can be used in theano.function. Implementations of iterative
33 optimization algorithms should be global functions with a signature like 33 optimization algorithms should be global functions with a signature like
34 'iterative_optimizer'. 34 'iterative_optimizer'.
35
36 .. code-block:: python
35 37
36 def iterative_optimizer(parameters, 38 def iterative_optimizer(parameters,
37 cost=None, 39 cost=None,
38 gradients=None, 40 gradients=None,
39 stop=None, 41 stop=None,
82 84
83 The numpy interface to optimization algorithms is supposed to mimick 85 The numpy interface to optimization algorithms is supposed to mimick
84 scipy's. Its arguments are numpy arrays, and functions that manipulate numpy 86 scipy's. Its arguments are numpy arrays, and functions that manipulate numpy
85 arrays. 87 arrays.
86 88
89 .. code-block:: python
90
87 def minimize(x0, f, df, opt_algo, **kwargs): 91 def minimize(x0, f, df, opt_algo, **kwargs):
88 """ 92 """
89 Return a point x_new with the same type as x0 that minimizes function `f` 93 Return a point x_new with the same type as x0 that minimizes function `f`
90 with derivative `df`. 94 with derivative `df`.
91 95
111 115
112 There is also a numpy-based wrapper to the iterative algorithms. 116 There is also a numpy-based wrapper to the iterative algorithms.
113 This can be more useful than minimize() because it doesn't hog program 117 This can be more useful than minimize() because it doesn't hog program
114 control. Technically minimize() is probably implemented using this 118 control. Technically minimize() is probably implemented using this
115 minimize_iterator interface. 119 minimize_iterator interface.
120
121 .. code-block:: python
116 122
117 class minimize_iterator(object): 123 class minimize_iterator(object):
118 """ 124 """
119 Attributes 125 Attributes
120 - x - the current best estimate of the minimum 126 - x - the current best estimate of the minimum