Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages |
#include <elxPreconditionedGradientDescent.h>
A gradient descent optimizer with a decaying gain.
This class is a wrap around the AdaptiveStochasticPreconditionedGradientOptimizer class. It takes care of setting parameters and printing progress information. For more information about the optimization method, please read the documentation of the AdaptiveStochasticPreconditionedGradientOptimizer class.
The parameters used in this class are:
Optimizer: Select this optimizer as follows:
(Optimizer "PreconditionedGradientDescent")
MaximumNumberOfIterations: The maximum number of iterations in each resolution.
example: (MaximumNumberOfIterations 100 100 50)
Default/recommended value: 500.
MaximumNumberOfSamplingAttempts: The maximum number of sampling attempts. Sometimes not enough corresponding samples can be drawn, upon which an exception is thrown. With this parameter it is possible to try to draw another set of samples.
example: (MaximumNumberOfSamplingAttempts 10 15 10)
Default value: 0, i.e. just fail immediately, for backward compatibility.
SP_a: The gain at each iteration is defined by
.
SP_a can be defined for each resolution.
example: (SP_a 3200.0 3200.0 1600.0)
The default value is 400.0. Tuning this variable for you specific problem is recommended.
SP_A: The gain at each iteration is defined by
.
SP_A can be defined for each resolution.
example: (SP_A 50.0 50.0 100.0)
The default/recommended value is 50.0.
SP_alpha: The gain at each iteration is defined by
.
SP_alpha can be defined for each resolution.
example: (SP_alpha 0.602 0.602 0.602)
The default/recommended value is 0.602.
Definition at line 72 of file elxPreconditionedGradientDescent.h.
Data Structures | |
struct | SettingsType |
Public Member Functions | |
virtual void | AfterEachIteration (void) |
virtual void | AfterEachResolution (void) |
virtual void | AfterRegistration (void) |
virtual void | BeforeEachResolution (void) |
virtual void | BeforeRegistration (void) |
elxClassNameMacro ("PreconditionedGradientDescent") | |
virtual bool | GetAutomaticParameterEstimation () const |
virtual const char * | GetClassName () const |
virtual const unsigned long & | GetMaximumNumberOfSamplingAttempts () |
virtual void | MetricErrorResponse (itk::ExceptionObject &err) |
virtual void | ResumeOptimization (void) |
virtual void | SetAutomaticParameterEstimation (bool _arg) |
virtual void | SetCurrentPositionPublic (const ParametersType ¶m) |
virtual void | SetMaximumNumberOfSamplingAttempts (unsigned long _arg) |
virtual void | StartOptimization (void) |
Public Member Functions inherited from itk::AdaptiveStochasticPreconditionedGradientDescentOptimizer | |
virtual const char * | GetClassName () const |
virtual double | GetSigmoidMax () const |
virtual double | GetSigmoidMin () const |
virtual double | GetSigmoidScale () const |
virtual bool | GetUseAdaptiveStepSizes () const |
virtual void | SetSigmoidMax (double _arg) |
virtual void | SetSigmoidMin (double _arg) |
virtual void | SetSigmoidScale (double _arg) |
virtual void | SetUseAdaptiveStepSizes (bool _arg) |
Public Member Functions inherited from itk::StochasticPreconditionedGradientDescentOptimizer | |
virtual void | AdvanceOneStep (void) |
virtual const char * | GetClassName () const |
virtual double | GetCurrentTime () const |
virtual double | GetInitialTime () const |
virtual double | GetParam_a () const |
virtual double | GetParam_A () const |
virtual double | GetParam_alpha () const |
virtual void | SetInitialTime (double _arg) |
virtual void | SetParam_a (double _arg) |
virtual void | SetParam_A (double _arg) |
virtual void | SetParam_alpha (double _arg) |
virtual void | StartOptimization (void) |
Public Member Functions inherited from itk::PreconditionedGradientDescentOptimizer | |
virtual void | AdvanceOneStep (void) |
const cholmod_common * | GetCholmodCommon (void) const |
const cholmod_factor * | GetCholmodFactor (void) const |
virtual const char * | GetClassName () const |
virtual double | GetConditionNumber () const |
virtual unsigned int | GetCurrentIteration () const |
virtual double | GetDiagonalWeight () const |
virtual const DerivativeType & | GetGradient () |
virtual double | GetLargestEigenValue () const |
virtual const double & | GetLearningRate () |
virtual double | GetMinimumGradientElementMagnitude () const |
virtual const unsigned long & | GetNumberOfIterations () |
virtual const DerivativeType & | GetSearchDirection () |
virtual double | GetSparsity () const |
virtual const StopConditionType & | GetStopCondition () |
virtual const double & | GetValue () |
virtual void | MetricErrorResponse (ExceptionObject &err) |
virtual void | ResumeOptimization (void) |
virtual void | SetDiagonalWeight (double _arg) |
virtual void | SetLearningRate (double _arg) |
virtual void | SetMinimumGradientElementMagnitude (double _arg) |
virtual void | SetNumberOfIterations (unsigned long _arg) |
virtual void | SetPreconditionMatrix (PreconditionType &precondition) |
virtual void | StartOptimization (void) |
virtual void | StopOptimization (void) |
Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer | |
virtual const char * | GetClassName () const |
const ParametersType & | GetCurrentPosition (void) const override |
virtual bool | GetMaximize () const |
virtual const ScaledCostFunctionType * | GetScaledCostFunction () |
virtual const ParametersType & | GetScaledCurrentPosition () |
bool | GetUseScales (void) const |
virtual void | InitializeScales (void) |
virtual void | MaximizeOff () |
virtual void | MaximizeOn () |
void | SetCostFunction (CostFunctionType *costFunction) override |
virtual void | SetMaximize (bool _arg) |
virtual void | SetUseScales (bool arg) |
Public Member Functions inherited from elastix::OptimizerBase< TElastix > | |
void | AfterRegistrationBase (void) override |
void | BeforeEachResolutionBase () override |
virtual ITKBaseType * | GetAsITKBaseType (void) |
virtual const ITKBaseType * | GetAsITKBaseType (void) const |
virtual const char * | GetClassName () const |
virtual void | SetCurrentPositionPublic (const ParametersType ¶m) |
virtual void | SetSinusScales (double amplitude, double frequency, unsigned long numberOfParameters) |
Public Member Functions inherited from elastix::BaseComponentSE< TElastix > | |
ConfigurationType * | GetConfiguration (void) const |
ElastixType * | GetElastix (void) const |
RegistrationPointer | GetRegistration (void) const |
ITK_DISALLOW_COPY_AND_ASSIGN (BaseComponentSE) | |
void | SetConfiguration (ConfigurationType *_arg) |
void | SetElastix (ElastixType *_arg) |
Public Member Functions inherited from elastix::BaseComponent | |
virtual void | AfterEachIteration (void) |
virtual void | AfterEachIterationBase (void) |
virtual void | AfterEachResolution (void) |
virtual void | AfterEachResolutionBase (void) |
virtual void | AfterRegistration (void) |
virtual void | AfterRegistrationBase (void) |
virtual int | BeforeAll (void) |
virtual int | BeforeAllBase (void) |
virtual void | BeforeEachResolution (void) |
virtual void | BeforeEachResolutionBase (void) |
virtual void | BeforeRegistration (void) |
virtual void | BeforeRegistrationBase (void) |
virtual const char * | elxGetClassName (void) const |
const char * | GetComponentLabel (void) const |
ITK_DISALLOW_COPY_AND_ASSIGN (BaseComponent) | |
itkTypeMacroNoParent (BaseComponent) | |
void | SetComponentLabel (const char *label, unsigned int idx) |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::AdaptiveStochasticPreconditionedGradientDescentOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::StochasticPreconditionedGradientDescentOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::PreconditionedGradientDescentOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from elastix::BaseComponent | |
static std::string | ConvertSecondsToDHMS (const double totalSeconds, const unsigned int precision) |
static void | InitializeElastixExecutable () |
static bool | IsElastixLibrary () |
Private Member Functions | |
void | operator= (const Self &) |
PreconditionedGradientDescent (const Self &) | |
Private Attributes | |
bool | m_AutomaticParameterEstimation |
bool | m_AutomaticParameterEstimationDone |
unsigned long | m_CurrentNumberOfSamplingAttempts |
unsigned long | m_MaximumNumberOfSamplingAttempts |
bool | m_PreconditionMatrixSet |
unsigned long | m_PreviousErrorAtIteration |
typedef Superclass2::ConfigurationPointer elastix::PreconditionedGradientDescent< TElastix >::ConfigurationPointer |
Definition at line 107 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::ConfigurationType elastix::PreconditionedGradientDescent< TElastix >::ConfigurationType |
Definition at line 106 of file elxPreconditionedGradientDescent.h.
typedef itk::SmartPointer< const Self > elastix::PreconditionedGradientDescent< TElastix >::ConstPointer |
Definition at line 83 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::CostFunctionPointer elastix::PreconditionedGradientDescent< TElastix >::CostFunctionPointer |
Definition at line 100 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::CostFunctionType elastix::PreconditionedGradientDescent< TElastix >::CostFunctionType |
Typedef's inherited from Superclass1, the AdaptiveStochasticPreconditionedGradientDescentOptimizer.
Definition at line 99 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::ElastixPointer elastix::PreconditionedGradientDescent< TElastix >::ElastixPointer |
Definition at line 105 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::ElastixType elastix::PreconditionedGradientDescent< TElastix >::ElastixType |
Typedef's inherited from Superclass2, the elastix OptimizerBase.
Definition at line 104 of file elxPreconditionedGradientDescent.h.
|
protected |
Samplers:
Definition at line 183 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 195 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 194 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 193 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 191 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 189 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 187 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 186 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 185 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::ITKBaseType elastix::PreconditionedGradientDescent< TElastix >::ITKBaseType |
Definition at line 110 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 184 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::ParametersType elastix::PreconditionedGradientDescent< TElastix >::ParametersType |
Typedef for the ParametersType.
Definition at line 113 of file elxPreconditionedGradientDescent.h.
typedef itk::SmartPointer< Self > elastix::PreconditionedGradientDescent< TElastix >::Pointer |
Definition at line 82 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::PreconditionType elastix::PreconditionedGradientDescent< TElastix >::PreconditionType |
Definition at line 117 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::PreconditionValueType elastix::PreconditionedGradientDescent< TElastix >::PreconditionValueType |
Some typedefs for computing the SelfHessian
Definition at line 116 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 180 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 179 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 178 of file elxPreconditionedGradientDescent.h.
|
protected |
Other protected typedefs
Definition at line 177 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::RegistrationPointer elastix::PreconditionedGradientDescent< TElastix >::RegistrationPointer |
Definition at line 109 of file elxPreconditionedGradientDescent.h.
typedef Superclass2::RegistrationType elastix::PreconditionedGradientDescent< TElastix >::RegistrationType |
Definition at line 108 of file elxPreconditionedGradientDescent.h.
typedef PreconditionedGradientDescent elastix::PreconditionedGradientDescent< TElastix >::Self |
Standard ITK.
Definition at line 79 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 174 of file elxPreconditionedGradientDescent.h.
typedef Superclass1::StopConditionType elastix::PreconditionedGradientDescent< TElastix >::StopConditionType |
Definition at line 101 of file elxPreconditionedGradientDescent.h.
typedef AdaptiveStochasticPreconditionedGradientDescentOptimizer elastix::PreconditionedGradientDescent< TElastix >::Superclass1 |
Definition at line 80 of file elxPreconditionedGradientDescent.h.
typedef OptimizerBase< TElastix > elastix::PreconditionedGradientDescent< TElastix >::Superclass2 |
Definition at line 81 of file elxPreconditionedGradientDescent.h.
|
protected |
|
inlineprotectedvirtual |
Definition at line 198 of file elxPreconditionedGradientDescent.h.
|
private |
|
protectedvirtual |
Helper function that adds a random perturbation delta to the input parameters, with delta ~ sigma * N(0,I). Used by SampleGradients.
|
virtual |
Reimplemented from elastix::BaseComponent.
|
virtual |
Reimplemented from elastix::BaseComponent.
|
virtual |
Reimplemented from elastix::BaseComponent.
|
protectedvirtual |
Estimates some reasonable values for the parameters SP_a, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), and SigmoidScale.
|
virtual |
Reimplemented from elastix::BaseComponent.
|
virtual |
Methods invoked by elastix, in which parameters can be set and progress information can be printed.
Reimplemented from elastix::BaseComponent.
elastix::PreconditionedGradientDescent< TElastix >::elxClassNameMacro | ( | "PreconditionedGradientDescent< TElastix >" | ) |
Name of this class. Use this name in the parameter file to select this specific optimizer. example: (Optimizer "PreconditionedGradientDescent")
|
virtual |
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::AdaptiveStochasticPreconditionedGradientDescentOptimizer.
|
virtual |
Get the MaximumNumberOfSamplingAttempts.
|
protectedvirtual |
Helper function, which calls GetScaledValueAndDerivative and does some exception handling. Used by SampleGradients.
|
virtual |
Stop optimization and pass on exception.
|
static |
Method for creation through the object factory.
|
private |
|
protectedvirtual |
Print the contents of the settings vector to elxout.
|
virtual |
Set the SelfHessian as a preconditioning matrix and call Superclass' implementation. Only done when m_PreconditionMatrixSet == false; If automatic gain estimation is desired, then estimate SP_a, SP_alpha SigmoidScale, SigmoidMax, SigmoidMin. After that call Superclass' implementation.
Reimplemented from itk::PreconditionedGradientDescentOptimizer.
|
protectedvirtual |
Measure some derivatives, exact and approximated. Returns the sigma1 and sigma2. Needed for the automatic parameter estimation. Gradients are measured at position mu_n, which are generated according to: mu_n - mu_0 ~ N(0, perturbationSigma P ); perturbationSigma = sigma1 = 1/N g_0' P g_0, where g_0 is the exact gradient at mu_0, and N the number of parameters. sigma2 = 1/N sum_n g_n' P g_n / (sum_n n), where g_n is the approximated gradient at mu_0. NB: sigma1 = sqr(sigma_1), sigma2 = sqr(sigma_2), compared to my notes.
|
virtual |
Set/Get whether automatic parameter estimation is desired. If true, make sure to set the maximum step length.
The following parameters are automatically determined: SP_a = 2*SP_A, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), SigmoidScale. A usually suitable value for SP_A is 20, which is the default setting, if not specified by the user.
|
inlinevirtual |
Add SetCurrentPositionPublic, which calls the protected SetCurrentPosition of the itkAdaptiveStochasticPreconditionedGradientDescentOptimizer class.
Definition at line 140 of file elxPreconditionedGradientDescent.h.
|
virtual |
Set the MaximumNumberOfSamplingAttempts.
|
protectedvirtual |
Get the SelfHessian from the metric and submit as Precondition matrix
|
virtual |
Check if any scales are set, and set the UseScales flag on or off; after that call the superclass' implementation.
Reimplemented from itk::StochasticPreconditionedGradientDescentOptimizer.
|
private |
Definition at line 261 of file elxPreconditionedGradientDescent.h.
|
private |
Definition at line 262 of file elxPreconditionedGradientDescent.h.
|
private |
Definition at line 255 of file elxPreconditionedGradientDescent.h.
|
private |
Private variables for the sampling attempts.
Definition at line 254 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 203 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 204 of file elxPreconditionedGradientDescent.h.
|
private |
Private variables for self Hessian support.
Definition at line 259 of file elxPreconditionedGradientDescent.h.
|
private |
Definition at line 256 of file elxPreconditionedGradientDescent.h.
|
protected |
RandomGenerator for AddRandomPerturbation.
Definition at line 208 of file elxPreconditionedGradientDescent.h.
|
protected |
Variable to store the automatically determined settings for each resolution.
Definition at line 201 of file elxPreconditionedGradientDescent.h.
|
protected |
Definition at line 205 of file elxPreconditionedGradientDescent.h.
Generated on 1667476801 for elastix by 1.9.4 |