go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Static 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 53 of file itkGradientDescentOptimizer2.h.

Inheritance diagram for itk::GradientDescentOptimizer2:
Inheritance graph
[legend]

Data Structures

struct  MultiThreaderParameterType
 

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 StopConditionTypeGetStopCondition ()
 
virtual const doubleGetValue ()
 
virtual void MetricErrorResponse (ExceptionObject &err)
 
virtual void ResumeOptimization (void)
 
virtual void SetLearningRate (double _arg)
 
virtual void SetNumberOfIterations (unsigned long _arg)
 
void SetNumberOfThreads (ThreadIdType numberOfThreads)
 
virtual void SetUseEigen (bool _arg)
 
virtual void SetUseMultiThread (bool _arg)
 
virtual void SetUseOpenMP (bool _arg)
 
virtual void StartOptimization (void)
 
virtual void StopOptimization (void)
 
- Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual const ParametersTypeGetCurrentPosition (void) const
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersTypeGetScaledCurrentPosition ()
 
bool GetUseScales (void) const
 
virtual void InitializeScales (void)
 
virtual void MaximizeOff ()
 
virtual void MaximizeOn ()
 
virtual void SetCostFunction (CostFunctionType *costFunction)
 
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 Types

typedef itk::MultiThreader ThreaderType
 
typedef ThreaderType::ThreadInfoStruct ThreadInfoType
 

Protected Member Functions

 GradientDescentOptimizer2 ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
virtual ~GradientDescentOptimizer2 ()
 
- 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
 
 ScaledSingleValuedNonLinearOptimizer ()
 
virtual void SetCurrentPosition (const ParametersType &param)
 
virtual void SetScaledCurrentPosition (const ParametersType &parameters)
 
virtual ~ScaledSingleValuedNonLinearOptimizer ()
 

Protected Attributes

unsigned long m_CurrentIteration
 
DerivativeType m_Gradient
 
double m_LearningRate
 
unsigned long m_NumberOfIterations
 
bool m_Stop
 
StopConditionType m_StopCondition
 
ThreaderType::Pointer m_Threader
 
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 &)
 
void ThreadedAdvanceOneStep (ThreadIdType threadId, ParametersType &newPosition)
 

Static Private Member Functions

static ITK_THREAD_RETURN_TYPE AdvanceOneStepThreaderCallback (void *arg)
 

Private Attributes

bool m_UseEigen
 
bool m_UseMultiThread
 
bool m_UseOpenMP
 

Member Typedef Documentation

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

Definition at line 62 of file itkGradientDescentOptimizer2.h.

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

Definition at line 74 of file itkGradientDescentOptimizer2.h.

Definition at line 73 of file itkGradientDescentOptimizer2.h.

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

Typedefs inherited from the superclass.

Definition at line 68 of file itkGradientDescentOptimizer2.h.

Definition at line 72 of file itkGradientDescentOptimizer2.h.

Definition at line 61 of file itkGradientDescentOptimizer2.h.

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

Definition at line 77 of file itkGradientDescentOptimizer2.h.

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

Definition at line 76 of file itkGradientDescentOptimizer2.h.

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

Definition at line 75 of file itkGradientDescentOptimizer2.h.

Standard class typedefs.

Definition at line 59 of file itkGradientDescentOptimizer2.h.

Definition at line 60 of file itkGradientDescentOptimizer2.h.

typedef itk::MultiThreader itk::GradientDescentOptimizer2::ThreaderType
protected

Typedefs for multi-threading.

Definition at line 149 of file itkGradientDescentOptimizer2.h.

typedef ThreaderType::ThreadInfoStruct itk::GradientDescentOptimizer2::ThreadInfoType
protected

Definition at line 150 of file itkGradientDescentOptimizer2.h.

Member Enumeration Documentation

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

Enumerator
MaximumNumberOfIterations 
MetricError 
MinimumStepSize 

Definition at line 82 of file itkGradientDescentOptimizer2.h.

Constructor & Destructor Documentation

itk::GradientDescentOptimizer2::GradientDescentOptimizer2 ( )
protected
virtual itk::GradientDescentOptimizer2::~GradientDescentOptimizer2 ( )
inlineprotectedvirtual

Definition at line 145 of file itkGradientDescentOptimizer2.h.

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

Member Function Documentation

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

Advance one step following the gradient direction.

Reimplemented in itk::StandardGradientDescentOptimizer.

static ITK_THREAD_RETURN_TYPE itk::GradientDescentOptimizer2::AdvanceOneStepThreaderCallback ( void *  arg)
staticprivate

The callback function.

virtual const char* itk::GradientDescentOptimizer2::GetClassName ( ) const
virtual
virtual unsigned int itk::GradientDescentOptimizer2::GetCurrentIteration ( ) const
virtual

Get the current iteration number.

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

Get current gradient.

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

Get the learning rate.

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

Get the number of iterations.

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

Get Stop condition.

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

Get the current value.

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

Stop optimization and pass on exception.

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

Method for creation through the object factory.

void itk::GradientDescentOptimizer2::operator= ( const Self )
private
void itk::GradientDescentOptimizer2::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protected
virtual void itk::GradientDescentOptimizer2::ResumeOptimization ( void  )
virtual

Resume previously stopped optimization with current parameters

See also
StopOptimization.

Reimplemented in elastix::AdaptiveStochasticGradientDescent< TElastix >.

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

Set the learning rate.

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

Set the number of iterations.

void itk::GradientDescentOptimizer2::SetNumberOfThreads ( ThreadIdType  numberOfThreads)
inline

Set the number of threads.

Definition at line 130 of file itkGradientDescentOptimizer2.h.

virtual void itk::GradientDescentOptimizer2::SetUseEigen ( bool  _arg)
virtual
virtual void itk::GradientDescentOptimizer2::SetUseMultiThread ( bool  _arg)
virtual
virtual void itk::GradientDescentOptimizer2::SetUseOpenMP ( bool  _arg)
virtual
virtual void itk::GradientDescentOptimizer2::StartOptimization ( void  )
virtual
virtual void itk::GradientDescentOptimizer2::StopOptimization ( void  )
virtual

Stop optimization.

See also
ResumeOptimization
void itk::GradientDescentOptimizer2::ThreadedAdvanceOneStep ( ThreadIdType  threadId,
ParametersType newPosition 
)
inlineprivate

The threaded implementation of AdvanceOneStep().

Field Documentation

unsigned long itk::GradientDescentOptimizer2::m_CurrentIteration
protected

Definition at line 162 of file itkGradientDescentOptimizer2.h.

DerivativeType itk::GradientDescentOptimizer2::m_Gradient
protected

Definition at line 154 of file itkGradientDescentOptimizer2.h.

double itk::GradientDescentOptimizer2::m_LearningRate
protected

Definition at line 155 of file itkGradientDescentOptimizer2.h.

unsigned long itk::GradientDescentOptimizer2::m_NumberOfIterations
protected

Definition at line 161 of file itkGradientDescentOptimizer2.h.

bool itk::GradientDescentOptimizer2::m_Stop
protected

Definition at line 160 of file itkGradientDescentOptimizer2.h.

StopConditionType itk::GradientDescentOptimizer2::m_StopCondition
protected

Definition at line 156 of file itkGradientDescentOptimizer2.h.

ThreaderType::Pointer itk::GradientDescentOptimizer2::m_Threader
protected

Definition at line 158 of file itkGradientDescentOptimizer2.h.

bool itk::GradientDescentOptimizer2::m_UseEigen
private

Definition at line 178 of file itkGradientDescentOptimizer2.h.

bool itk::GradientDescentOptimizer2::m_UseMultiThread
private

Definition at line 170 of file itkGradientDescentOptimizer2.h.

bool itk::GradientDescentOptimizer2::m_UseOpenMP
private

Definition at line 177 of file itkGradientDescentOptimizer2.h.

double itk::GradientDescentOptimizer2::m_Value
protected

Definition at line 153 of file itkGradientDescentOptimizer2.h.



Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo