spatula.optimize¶
Overview
|
Optimize by testing provided rotations. |
No optimization is performed. |
|
Base class for optimizers. |
|
|
Optimize by testing random rotations. |
|
Optimize by rounds of 3 1D gradient descents. |
|
Combine an optimization scheme with a specific secondary optimizer. |
Details
Classes to optimize over SO(3) for spatula.PGOP.
- class spatula.optimize.Mesh(points)[source]¶
Optimize by testing provided rotations.
- __init__(points)[source]¶
Create a Mesh optimizer.
- Parameters:
points ( numpy.ndarray of float) – The rotaional quaternions to test.
- class spatula.optimize.Optimizer[source]¶
Base class for optimizers.
- __weakref__¶
list of weak references to the object
- class spatula.optimize.RandomSearch(max_iter=150, seed=42)[source]¶
Optimize by testing random rotations.
- class spatula.optimize.StepGradientDescent(initial_point=(1.0, 0.0, 0.0, 0.0), max_iter=150, initial_jump=0.001, learning_rate=0.05, tol=1e-06)[source]¶
Optimize by rounds of 3 1D gradient descents.
The optimization uses a 3-vector, to represent rotations in . The conversion to the axis-angle representation for is
The representation is continuous in .
StepGradientDescentperforms potentially multiple rounds of 3 1-dimensional gradient descents, one for each dimension to find the local minimum. Each smaller optimization is terminated when the improvement in objective is less than the provided tolerance. The entire optimization ends when between rounds of optimization the decrease in objective is less than the provided tolerance.- __init__(initial_point=(1.0, 0.0, 0.0, 0.0), max_iter=150, initial_jump=0.001, learning_rate=0.05, tol=1e-06)[source]¶
Create a
StepGradientDescentobject.- Parameters:
optimizer (Optimizer) – The initial optimizer. The best/final point of this optimizer will be sent to the
StepGradientDescentas the initial point.initial_point ( numpy.ndarray of float, optional) – The initial point to start the optimization. Defaults to the identity quaternion.
max_iter (
int, optional) – The maximum number of iterations before stopping optimization. Defaults to 150.initial_jump (
float, optional) – The size of the initial jump in each dimension to get an initial gradient. Defaults to 0.001.learning_rate (
float, optional) – The degree to move along the gradient. Higher values lead to larger moves and can result in quicker convergence or failure to converge. Defaults to 0.05.tol (
float, optional) – The value that when the reduction in the object is less than the current optimization stops. The entire optimization stops when the objective from the last round of 1 dimensional optimizations is belowtol. Defaults to 1e-6.
- class spatula.optimize.Union[source]¶
Combine an optimization scheme with a specific secondary optimizer.
The union optimizer uses the best point from the first optimization to start the second optimizer.
- classmethod with_step_gradient_descent(optimizer, max_iter=150, initial_jump=0.001, learning_rate=0.055, tol=1e-06)[source]¶
Create a Union optimizer with a
StepGradientDescentsecond step.Arguments are passed through to the constructor of
StepGradientDescent.- Parameters:
optimizer (Optimizer) – The initial optimizer. The best/final point of this optimizer will be sent to the
StepGradientDescentas the initial point.max_iter (
int, optional) – The maximum number of iterations before stopping optimization. Defaults to 150.initial_jump (
float, optional) – The size of the initial jump in each dimension to get an initial gradient. Defaults to 0.001.learning_rate (
float, optional) – The degree to move along the gradient. Higher values lead to larger moves and can result in quicker convergence or failure to converge. Defaults to 0.05.tol (
float, optional) – The value that when the reduction in the object is less than the current optimization stops. The entire optimization stops when the objective from the last round of 1 dimensional optimizations is belowtol. Defaults to 1e-6.