You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/optimisation.rst
+60-54Lines changed: 60 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,7 @@ SIRT
101
101
102
102
ISTA/PGD
103
103
--------
104
-
The Iterative Soft Thresholding Algorithm (ISTA) is also known as Proximal Gradient Descent (PGD). Note that in CIL, :ref:`PGD<ISTA>` is an alias of `ISTA`.
104
+
The Iterative Soft Thresholding Algorithm (ISTA) is also known as Proximal Gradient Descent (PGD). Note that in CIL, :ref:`PGD<ISTA>` is an alias of `ISTA`.
105
105
106
106
.. _ISTA:
107
107
.. autoclass:: cil.optimisation.algorithms.ISTA
@@ -111,7 +111,7 @@ The Iterative Soft Thresholding Algorithm (ISTA) is also known as Proximal Gradi
111
111
112
112
FISTA
113
113
-----
114
-
The Fast Iterative Soft Thresholding Algorithm (FISTA).
114
+
The Fast Iterative Soft Thresholding Algorithm (FISTA).
115
115
116
116
.. _FISTA:
117
117
.. autoclass:: cil.optimisation.algorithms.FISTA
@@ -120,18 +120,18 @@ The Fast Iterative Soft Thresholding Algorithm (FISTA).
120
120
121
121
APGD
122
122
-----
123
-
The Accelerated Proximal Gradient Descent Algorithm (APGD). This is an extension of the PGD/ISTA algorithm allowing you to either use a constant momemtum or a momentum that is updated at each iteration.
123
+
The Accelerated Proximal Gradient Descent Algorithm (APGD). This is an extension of the PGD/ISTA algorithm allowing you to either use a constant momemtum or a momentum that is updated at each iteration.
where :math:`n` is the number of functions. Where there is a large number of :math:`f_i` or their gradients are expensive to calculate, stochastic optimisation methods could prove more efficient.
172
-
There is a growing range of Stochastic optimisation algorithms available with potential benefits of faster convergence in number of iterations or in computational cost.
173
-
This is an area of continued development for CIL and, depending on the properties of the :math:`f_i` and the regulariser :math:`g`, there is a range of different options for the user.
171
+
where :math:`n` is the number of functions. Where there is a large number of :math:`f_i` or their gradients are expensive to calculate, stochastic optimisation methods could prove more efficient.
172
+
There is a growing range of Stochastic optimisation algorithms available with potential benefits of faster convergence in number of iterations or in computational cost.
173
+
This is an area of continued development for CIL and, depending on the properties of the :math:`f_i` and the regulariser :math:`g`, there is a range of different options for the user.
174
174
175
175
176
176
177
177
SPDHG
178
178
-----
179
-
Stochastic Primal Dual Hybrid Gradient (SPDHG) is a stochastic version of PDHG and deals with optimisation problems of the form:
180
-
179
+
Stochastic Primal Dual Hybrid Gradient (SPDHG) is a stochastic version of PDHG and deals with optimisation problems of the form:
where :math:`f_i` and the regulariser :math:`g` need only be proper, convex and lower semi-continuous ( i.e. do not need to be differentiable).
185
+
where :math:`f_i` and the regulariser :math:`g` need only be proper, convex and lower semi-continuous ( i.e. do not need to be differentiable).
186
186
Each iteration considers just one index of the sum, potentially reducing computational cost. For more examples see our [user notebooks]( https://github.com/vais-ral/CIL-Demos/blob/master/Tomography/Simulated/Single%20Channel/PDHG_vs_SPDHG.py).
187
187
188
188
@@ -194,23 +194,23 @@ Each iteration considers just one index of the sum, potentially reducing computa
194
194
Approximate gradient methods
195
195
----------------------------------
196
196
197
-
Alternatively, consider that, in addition to the functions :math:`f_i` and the regulariser :math:`g` being proper, convex and lower semi-continuous, the :math:`f_i` are differentiable. In this case we consider stochastic methods that replace a gradient calculation in a deterministic algorithm with a, potentially cheaper to calculate, approximate gradient.
197
+
Alternatively, consider that, in addition to the functions :math:`f_i` and the regulariser :math:`g` being proper, convex and lower semi-continuous, the :math:`f_i` are differentiable. In this case we consider stochastic methods that replace a gradient calculation in a deterministic algorithm with a, potentially cheaper to calculate, approximate gradient.
198
198
For example, when :math:`g(x)=0`, the standard Gradient Descent algorithm utilises iterations of the form
:math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with :math:`n \nabla f_i(x_k)`, for an index :math:`i` which changes each iteration, leads to the well known stochastic gradient descent algorithm.
202
+
:math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with :math:`n \nabla f_i(x_k)`, for an index :math:`i` which changes each iteration, leads to the well known stochastic gradient descent algorithm.
203
203
204
204
205
205
206
-
Replacing, :math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with :math:`n \nabla f_i(x_k)`, for an index :math:`i` which changes each iteration, leads to the well known stochastic gradient descent algorithm.
206
+
Replacing, :math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with :math:`n \nabla f_i(x_k)`, for an index :math:`i` which changes each iteration, leads to the well known stochastic gradient descent algorithm.
207
207
208
-
In addition, if :math:`g(x)\neq0` and has a calculable proximal ( need not be differentiable) one can consider ISTA iterations:
208
+
In addition, if :math:`g(x)\neq0` and has a calculable proximal ( need not be differentiable) one can consider ISTA iterations:
and again replacing :math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with an approximate gradient.
213
+
and again replacing :math:`\nabla f(x_k)=\sum_{i=0}^{n-1}\nabla f_i(x_k)` with an approximate gradient.
214
214
215
215
In a similar way, plugging approximate gradient calculations into deterministic algorithms can lead to a range of stochastic algorithms. In the following table, the left hand column has the approximate gradient function subclass, :ref:`Approximate Gradient base class` the header row has one of CIL's deterministic optimisation algorithm and the body of the table has the resulting stochastic algorithm.
216
216
@@ -228,9 +228,9 @@ In a similar way, plugging approximate gradient calculations into deterministic
All the approximate gradients written in CIL are of a similar order of magnitude to the full gradient calculation. For example, in the :code:`SGFunction` we approximate the full gradient by :math:`n\nabla f_i` for an index :math:`i` given by the sampler.
275
+
All the approximate gradients written in CIL are of a similar order of magnitude to the full gradient calculation. For example, in the :code:`SGFunction` we approximate the full gradient by :math:`n\nabla f_i` for an index :math:`i` given by the sampler.
276
276
The multiplication by :math:`n` is a choice to more easily allow comparisons between stochastic and non-stochastic methods and between stochastic methods with varying numbers of subsets.
277
277
The multiplication ensures that the (SAGA, SGD, and SVRG and LSVRG) approximate gradients are an unbiased estimator of the full gradient ie :math:`\mathbb{E}\left[\tilde\nabla f(x)\right] =\nabla f(x)`.
278
-
This has an implication when choosing step sizes. For example, a suitable step size for GD with a SGFunction could be
279
-
:math:`\propto1/(L_{max}*n)`, where :math:`L_{max}` is the largest Lipschitz constant of the list of functions in the SGFunction and the additional factor of :math:`n` reflects this multiplication by :math:`n` in the approximate gradient.
278
+
This has an implication when choosing step sizes. For example, a suitable step size for GD with a SGFunction could be
279
+
:math:`\propto1/(L_{max}*n)`, where :math:`L_{max}` is the largest Lipschitz constant of the list of functions in the SGFunction and the additional factor of :math:`n` reflects this multiplication by :math:`n` in the approximate gradient.
280
+
280
281
281
-
282
282
Memory requirements
283
283
-------------------
284
284
Note that the approximate gradient methods have different memory requirements:
285
285
+ The `SGFunction` has the same requirements as a `SumFunction`, so no increased memory usage
286
-
+ `SAGFunction` and `SAGAFunction` both store `n+3` times the image size in memory to store the last calculated gradient for each function in the sum and for intermediary calculations.
287
-
+ `SVRGFunction` and `LSVRGFunction` with the default `store_gradients = False` store 4 times the image size in memory, including the "snapshot" point and gradient. If `store_gradients = True`, some computational effort is saved, at the expensive of stored memory `n+4` times the image size.
286
+
+ `SAGFunction` and `SAGAFunction` both store `n+3` times the image size in memory to store the last calculated gradient for each function in the sum and for intermediary calculations.
287
+
+ `SVRGFunction` and `LSVRGFunction` with the default `store_gradients = False` store 4 times the image size in memory, including the "snapshot" point and gradient. If `store_gradients = True`, some computational effort is saved, at the expensive of stored memory `n+4` times the image size.
@@ -625,12 +625,12 @@ For ease of use we provide the following static methods in `cil.optimisation.uti
625
625
They will all instantiate a Sampler defined in the following class:
626
626
627
627
.. autoclass:: cil.optimisation.utilities.Sampler
628
-
628
+
629
629
630
630
The random samplers are instantiated from a random sampling class which is a child class of `cil.optimisation.utilities.sampler` and provides options for sampling with and without replacement:
A step size method is a class which acts on an algorithm and can be passed to `cil.optimisation.algorithm.GD`, `cil.optimisation.algorithm.ISTA` `cil.optimisation.algorithm.FISTA` and it's method `get_step_size` is called after the calculation of the gradient before the gradient descent step is taken. It outputs a float value to be used as the step-size.
711
+
A step size method is a class which acts on an algorithm and can be passed to `cil.optimisation.algorithm.GD`, `cil.optimisation.algorithm.ISTA` `cil.optimisation.algorithm.FISTA` and it's method `get_step_size` is called after the calculation of the gradient before the gradient descent step is taken. It outputs a float value to be used as the step-size.
706
712
707
713
Currently in CIL we have a base class:
708
714
@@ -724,7 +730,7 @@ We also have a number of example classes:
724
730
725
731
Preconditioners
726
732
----------------
727
-
A preconditioner is a class which acts on an algorithm and can be passed to `cil.optimisation.algorithm.GD`, `cil.optimisation.algorithm.ISTA` or `cil.optimisation.algorithm.FISTA` and it's method `apply` is called after the calculation of the gradient before the gradient descent step is taken. It modifies and returns a passed `gradient`.
733
+
A preconditioner is a class which acts on an algorithm and can be passed to `cil.optimisation.algorithm.GD`, `cil.optimisation.algorithm.ISTA` or `cil.optimisation.algorithm.FISTA` and it's method `apply` is called after the calculation of the gradient before the gradient descent step is taken. It modifies and returns a passed `gradient`.
0 commit comments