go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
itk::GradientDescentOptimizer2 Class Reference

#include <itkGradientDescentOptimizer2.h>

Detailed Description

Implement a gradient descent optimizer.

GradientDescentOptimizer2 implements a simple gradient descent optimizer. At each iteration the current position is updated according to

\[
       p_{n+1} = p_n
               + \mbox{learningRate}
               \, \frac{\partial f(p_n) }{\partial p_n}
\]

The learning rate is a fixed scalar defined via SetLearningRate(). The optimizer steps through a user defined number of iterations; no convergence checking is done.

Additionally, user can scale each component of the $\partial f / \partial p$ but setting a scaling vector using method SetScale().

The difference of this class with the itk::GradientDescentOptimizer is that it's based on the ScaledSingleValuedNonLinearOptimizer

See also
ScaledSingleValuedNonLinearOptimizer

Definition at line 54 of file itkGradientDescentOptimizer2.h.

+ Inheritance diagram for itk::GradientDescentOptimizer2:

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef Superclass::ScaledCostFunctionPointer ScaledCostFunctionPointer
 
typedef Superclass::ScaledCostFunctionType ScaledCostFunctionType
 
typedef Superclass::ScalesType ScalesType
 
typedef GradientDescentOptimizer2 Self
 
enum  StopConditionType { MaximumNumberOfIterations , MetricError , MinimumStepSize }
 
typedef ScaledSingleValuedNonLinearOptimizer Superclass
 
- Public Types inherited from itk::ScaledSingleValuedNonLinearOptimizer
typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef ScaledCostFunctionType::Pointer ScaledCostFunctionPointer
 
typedef ScaledSingleValuedCostFunction ScaledCostFunctionType
 
typedef NonLinearOptimizer::ScalesType ScalesType
 
typedef ScaledSingleValuedNonLinearOptimizer Self
 
typedef SingleValuedNonLinearOptimizer Superclass
 

Public Member Functions

virtual void AdvanceOneStep (void)
 
virtual const char * GetClassName () const
 
virtual unsigned int GetCurrentIteration () const
 
virtual const DerivativeTypeGetGradient ()
 
virtual const doubleGetLearningRate ()
 
virtual const unsigned long & GetNumberOfIterations ()
 
virtual const DerivativeTypeGetSearchDirection ()
 
virtual const StopConditionTypeGetStopCondition ()
 
virtual const doubleGetValue ()
 
virtual void MetricErrorResponse (ExceptionObject &err)
 
virtual void ResumeOptimization (void)
 
virtual void SetLearningRate (double _arg)
 
virtual void SetNumberOfIterations (unsigned long _arg)
 
virtual void SetUseOpenMP (bool _arg)
 
void StartOptimization (void) override
 
virtual void StopOptimization (void)
 
- Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual const char * GetClassName () const
 
const ParametersTypeGetCurrentPosition (void) const override
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersTypeGetScaledCurrentPosition ()
 
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)
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
static Pointer New ()
 

Protected Member Functions

 GradientDescentOptimizer2 ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~GradientDescentOptimizer2 () override
 
- Protected Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual void GetScaledDerivative (const ParametersType &parameters, DerivativeType &derivative) const
 
virtual MeasureType GetScaledValue (const ParametersType &parameters) const
 
virtual void GetScaledValueAndDerivative (const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ScaledSingleValuedNonLinearOptimizer ()
 
void SetCurrentPosition (const ParametersType &param) override
 
virtual void SetScaledCurrentPosition (const ParametersType &parameters)
 
 ~ScaledSingleValuedNonLinearOptimizer () override
 

Protected Attributes

unsigned long m_CurrentIteration
 
DerivativeType m_Gradient
 
double m_LearningRate
 
unsigned long m_NumberOfIterations
 
DerivativeType m_SearchDirection
 
bool m_Stop
 
StopConditionType m_StopCondition
 
double m_Value
 
- Protected Attributes inherited from itk::ScaledSingleValuedNonLinearOptimizer
ScaledCostFunctionPointer m_ScaledCostFunction
 
ParametersType m_ScaledCurrentPosition
 

Private Member Functions

 GradientDescentOptimizer2 (const Self &)
 
void operator= (const Self &)
 

Private Attributes

bool m_UseOpenMP
 

Member Typedef Documentation

◆ ConstPointer

typedef SmartPointer< const Self > itk::GradientDescentOptimizer2::ConstPointer

Definition at line 63 of file itkGradientDescentOptimizer2.h.

◆ CostFunctionType

typedef Superclass::CostFunctionType itk::GradientDescentOptimizer2::CostFunctionType

Definition at line 75 of file itkGradientDescentOptimizer2.h.

◆ DerivativeType

Definition at line 74 of file itkGradientDescentOptimizer2.h.

◆ MeasureType

typedef Superclass::MeasureType itk::GradientDescentOptimizer2::MeasureType

Typedefs inherited from the superclass.

Definition at line 72 of file itkGradientDescentOptimizer2.h.

◆ ParametersType

Definition at line 73 of file itkGradientDescentOptimizer2.h.

◆ Pointer

Definition at line 62 of file itkGradientDescentOptimizer2.h.

◆ ScaledCostFunctionPointer

typedef Superclass::ScaledCostFunctionPointer itk::GradientDescentOptimizer2::ScaledCostFunctionPointer

Definition at line 78 of file itkGradientDescentOptimizer2.h.

◆ ScaledCostFunctionType

typedef Superclass::ScaledCostFunctionType itk::GradientDescentOptimizer2::ScaledCostFunctionType

Definition at line 77 of file itkGradientDescentOptimizer2.h.

◆ ScalesType

typedef Superclass::ScalesType itk::GradientDescentOptimizer2::ScalesType

Definition at line 76 of file itkGradientDescentOptimizer2.h.

◆ Self

Standard class typedefs.

Definition at line 60 of file itkGradientDescentOptimizer2.h.

◆ Superclass

Definition at line 61 of file itkGradientDescentOptimizer2.h.

Member Enumeration Documentation

◆ StopConditionType

Codes of stopping conditions The MinimumStepSize stopcondition never occurs, but may be implemented in inheriting classes

Enumerator
MaximumNumberOfIterations 
MetricError 
MinimumStepSize 

Definition at line 83 of file itkGradientDescentOptimizer2.h.

Constructor & Destructor Documentation

◆ GradientDescentOptimizer2() [1/2]

itk::GradientDescentOptimizer2::GradientDescentOptimizer2 ( )
protected

◆ ~GradientDescentOptimizer2()

itk::GradientDescentOptimizer2::~GradientDescentOptimizer2 ( )
inlineoverrideprotected

Definition at line 139 of file itkGradientDescentOptimizer2.h.

◆ GradientDescentOptimizer2() [2/2]

itk::GradientDescentOptimizer2::GradientDescentOptimizer2 ( const Self )
private

Member Function Documentation

◆ AdvanceOneStep()

virtual void itk::GradientDescentOptimizer2::AdvanceOneStep ( void  )
virtual

◆ GetClassName()

virtual const char * itk::GradientDescentOptimizer2::GetClassName ( ) const
virtual

◆ GetCurrentIteration()

virtual unsigned int itk::GradientDescentOptimizer2::GetCurrentIteration ( ) const
virtual

Get the current iteration number.

◆ GetGradient()

virtual const DerivativeType & itk::GradientDescentOptimizer2::GetGradient ( )
virtual

Get current gradient.

◆ GetLearningRate()

virtual const double & itk::GradientDescentOptimizer2::GetLearningRate ( )
virtual

Get the learning rate.

◆ GetNumberOfIterations()

virtual const unsigned long & itk::GradientDescentOptimizer2::GetNumberOfIterations ( )
virtual

Get the number of iterations.

◆ GetSearchDirection()

virtual const DerivativeType & itk::GradientDescentOptimizer2::GetSearchDirection ( )
virtual

Get current search direction

◆ GetStopCondition()

virtual const StopConditionType & itk::GradientDescentOptimizer2::GetStopCondition ( )
virtual

Get Stop condition.

◆ GetValue()

virtual const double & itk::GradientDescentOptimizer2::GetValue ( )
virtual

Get the current value.

◆ MetricErrorResponse()

virtual void itk::GradientDescentOptimizer2::MetricErrorResponse ( ExceptionObject &  err)
virtual

Stop optimization and pass on exception.

◆ New()

static Pointer itk::GradientDescentOptimizer2::New ( )
static

Method for creation through the object factory.

◆ operator=()

void itk::GradientDescentOptimizer2::operator= ( const Self )
private

◆ PrintSelf()

void itk::GradientDescentOptimizer2::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotected

◆ ResumeOptimization()

virtual void itk::GradientDescentOptimizer2::ResumeOptimization ( void  )
virtual

◆ SetLearningRate()

virtual void itk::GradientDescentOptimizer2::SetLearningRate ( double  _arg)
virtual

Set the learning rate.

◆ SetNumberOfIterations()

virtual void itk::GradientDescentOptimizer2::SetNumberOfIterations ( unsigned long  _arg)
virtual

Set the number of iterations.

◆ SetUseOpenMP()

virtual void itk::GradientDescentOptimizer2::SetUseOpenMP ( bool  _arg)
virtual

Set use OpenMP or not.

◆ StartOptimization()

void itk::GradientDescentOptimizer2::StartOptimization ( void  )
override

Start optimization.

◆ StopOptimization()

virtual void itk::GradientDescentOptimizer2::StopOptimization ( void  )
virtual

Stop optimization.

See also
ResumeOptimization

Field Documentation

◆ m_CurrentIteration

unsigned long itk::GradientDescentOptimizer2::m_CurrentIteration
protected

Definition at line 151 of file itkGradientDescentOptimizer2.h.

◆ m_Gradient

DerivativeType itk::GradientDescentOptimizer2::m_Gradient
protected

Definition at line 144 of file itkGradientDescentOptimizer2.h.

◆ m_LearningRate

double itk::GradientDescentOptimizer2::m_LearningRate
protected

Definition at line 146 of file itkGradientDescentOptimizer2.h.

◆ m_NumberOfIterations

unsigned long itk::GradientDescentOptimizer2::m_NumberOfIterations
protected

Definition at line 150 of file itkGradientDescentOptimizer2.h.

◆ m_SearchDirection

DerivativeType itk::GradientDescentOptimizer2::m_SearchDirection
protected

Definition at line 145 of file itkGradientDescentOptimizer2.h.

◆ m_Stop

bool itk::GradientDescentOptimizer2::m_Stop
protected

Definition at line 149 of file itkGradientDescentOptimizer2.h.

◆ m_StopCondition

StopConditionType itk::GradientDescentOptimizer2::m_StopCondition
protected

Definition at line 147 of file itkGradientDescentOptimizer2.h.

◆ m_UseOpenMP

bool itk::GradientDescentOptimizer2::m_UseOpenMP
private

Definition at line 158 of file itkGradientDescentOptimizer2.h.

◆ m_Value

double itk::GradientDescentOptimizer2::m_Value
protected

Definition at line 143 of file itkGradientDescentOptimizer2.h.



Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo