Mercurial > pylearn
annotate doc/v2_planning/api_optimization.txt @ 1118:8cc324f388ba
proposal for a plugin system
author | Olivier Breuleux <breuleuo@iro.umontreal.ca> |
---|---|
date | Tue, 14 Sep 2010 16:01:32 -0400 |
parents | c5c7ba805a2f |
children | 7c5dc11c850a |
rev | line source |
---|---|
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
1 Optimization API |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
2 ================ |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
3 |
1069
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
4 Members: Bergstra, Lamblin, Delalleau, Glorot, Breuleux, Bordes |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
5 Leader: Bergstra |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
6 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
7 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
8 Description |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
9 ----------- |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
10 |
1065 | 11 This API is for iterative optimization algorithms, such as: |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
12 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
13 - stochastic gradient descent (incl. momentum, annealing) |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
14 - delta bar delta |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
15 - conjugate methods |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
16 - L-BFGS |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
17 - "Hessian Free" |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
18 - SGD-QN |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
19 - TONGA |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
21 The API includes an iterative interface based on Theano, and a one-shot |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
22 interface similar to SciPy and MATLAB that is based on Python and Numpy, that |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
23 only uses Theano for the implementation. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
24 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
26 Theano Interface |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
27 ----------------- |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
28 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
29 The theano interface to optimization algorithms is to ask for a dictionary of |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
30 updates that can be used in theano.function. Implementations of iterative |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
31 optimization algorithms should be global functions with a signature like |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
32 'iterative_optimizer'. |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
33 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
34 def iterative_optimizer(parameters, |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
35 cost=None, |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
36 gradients=None, |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
37 stop=None, |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
38 updates=None, |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
39 **kwargs): |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
40 """ |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
41 :param parameters: list or tuple of Theano variables |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
42 that we want to optimize iteratively. If we're minimizing f(x), then |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
43 together, these variables represent 'x'. Typically these are shared |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
44 variables and their values are the initial values for the minimization |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
45 algorithm. |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
46 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
47 :param cost: scalar-valued Theano variable that computes an exact or noisy estimate of |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
48 cost (what are the conditions on the noise?). Some algorithms might |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
49 need an exact cost, some algorithms might ignore the cost if the |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
50 gradients are given. |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
51 |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
52 :param gradients: list or tuple of Theano variables representing the gradients on |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
53 the corresponding parameters. These default to tensor.grad(cost, |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
54 parameters). |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
55 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
56 :param stop: a shared variable (scalar integer) that (if provided) will be |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
57 updated to say when the iterative minimization algorithm has finished |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
58 (1) or requires more iterations (0). |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
59 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
60 :param updates: a dictionary to update with the (var, new_value) items |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
61 associated with the iterative algorithm. The default is a new empty |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
62 dictionary. A KeyError is raised in case of key collisions. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
63 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
64 :param kwargs: algorithm-dependent arguments |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
65 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
66 :returns: a dictionary mapping each parameter to an expression that it |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
67 should take in order to carry out the optimization procedure. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
68 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
69 If all the parameters are shared variables, then this dictionary may be |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
70 passed as the ``updates`` argument to theano.function. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
71 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
72 There may be more key,value pairs in the dictionary corresponding to |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
73 internal variables that are part of the optimization algorithm. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
74 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
75 """ |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
76 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
77 |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
78 Numpy Interface |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
79 --------------- |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
80 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
81 The numpy interface to optimization algorithms is supposed to mimick |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
82 scipy's. Its arguments are numpy arrays, and functions that manipulate numpy |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
83 arrays. |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
84 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
85 TODO: There is also room for an iterative object (that doesn't hog program |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
86 control) but which nonetheless works on numpy objects. Actually minimize() should |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
87 use this iterative interface under the hood. |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
88 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
89 def minimize(x0, f, df, opt_algo, **kwargs): |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
90 """ |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
91 Return a point x_new that minimizes function `f` with derivative `df`. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
92 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
93 This is supposed to provide an interface similar to scipy's minimize |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
94 routines, or MATLAB's. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
95 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
96 :type x0: numpy ndarray |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
97 :param x0: starting point for minimization |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
98 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
99 :type f: python callable mapping something like x0 to a scalar |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
100 :param f: function to minimize |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
101 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
102 :type df: python callable mapping something like x0 to the derivative of f at that point |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
103 :param df: derivative of `f` |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
104 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
105 :param opt_algo: one of the functions that implements the |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
106 `iterative_optimizer` interface. |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
107 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
108 :param kwargs: passed through to `opt_algo` |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
109 |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
110 """ |
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
111 |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
112 OD asks: Could it be more convenient for x0 to be a list? |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
113 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
114 JB replies: Yes, but that's not the interface used by other minimize() |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
115 routines (e.g. in scipy). Maybe another list-based interface is required? |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
116 |
1102
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
117 OD replies: I think most people would prefer to use a list-based interface, so |
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
118 they don't have to manually pack / unpack multiple arrrays of parameters. So I |
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
119 would vote in favor or having both (where the main reason to also provide a |
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
120 non-list interface would be to allow one to easily switch e.g. to scipy's |
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
121 minimize). |
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
122 I would guess the reason scipy's interface is like this is because it makes |
1108
c5c7ba805a2f
api_optimization: Edited comment - Unpacking is actually needed on each call to f/df
Olivier Delalleau <delallea@iro>
parents:
1102
diff
changeset
|
123 it easier for the optimization algorithm. However, this does not really |
c5c7ba805a2f
api_optimization: Edited comment - Unpacking is actually needed on each call to f/df
Olivier Delalleau <delallea@iro>
parents:
1102
diff
changeset
|
124 matter if we are just wrapping a theano-based algorithm (that already has |
c5c7ba805a2f
api_optimization: Edited comment - Unpacking is actually needed on each call to f/df
Olivier Delalleau <delallea@iro>
parents:
1102
diff
changeset
|
125 to handle multiple parameters), and avoiding useless data copies on each call |
c5c7ba805a2f
api_optimization: Edited comment - Unpacking is actually needed on each call to f/df
Olivier Delalleau <delallea@iro>
parents:
1102
diff
changeset
|
126 to f / df can only help speed-wise. |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
127 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
128 OD asks: Why make a difference between iterative and one-shot versions? A one-shot |
1069
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
129 algorithm can be seen as an iterative one that stops after its first |
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
130 iteration. The difference I see between the two interfaces proposed here |
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
131 is mostly that one relies on Theano while the other one does not, but |
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
132 hopefully a non-Theano one can be created by simply wrapping around the |
16ea3e5c5a7a
api_optimization: Couple questions
Olivier Delalleau <delallea@iro>
parents:
1065
diff
changeset
|
133 Theano one. |
1064
a41cc29cee26
v2planning optimization - API draft
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
diff
changeset
|
134 |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
135 JB replies: Right, it would make more sense to distinguish them by the fact that |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
136 one works on Theano objects, and the other on general Python callable functions. |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
137 There is room for an iterative numpy interface, but I didn't make it yet. Would |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
138 that answer your question? |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
139 |
1102
e7c52923f122
api_optimization: Couple replies
Olivier Delalleau <delallea@iro>
parents:
1100
diff
changeset
|
140 OD replies and asks: Partly. Do we really need a non-iterative interface? |
1100
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
141 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
142 Examples |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
143 -------- |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
144 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
145 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
146 Simple stochastic gradient descent with extra updates: |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
147 |
153cf820a975
v2planning - updates to api_optimization
James Bergstra <bergstrj@iro.umontreal.ca>
parents:
1069
diff
changeset
|
148 sgd([p], gradients=[g], updates={a:b}, step_size=.1) will return {a:b, p:p-.1*g} |