template<typename TInternalComputationValueType>
class itk::QuasiNewtonOptimizerv4Template< TInternalComputationValueType >
Implement a Quasi-Newton optimizer with BFGS Hessian estimation.
Second order approximation of the cost function is usually more efficient since it estimates the descent or ascent direction more precisely. However, computation of Hessian is usually expensive or unavailable. Alternatively Quasi-Newton methods can estimate a Hessian from the gradients in previous steps. Here a specific Quasi-Newton method, BFGS, is used to compute the Quasi-Newton steps.
The Quasi-Newton method doesn't produce a valid step sometimes, ex. when the metric function is not a convex locally. In this scenario, the gradient step is used after being scaled properly.
A helper member object, m_ScalesEstimator may be set to estimate parameter scales and step scales. A step scale measures the magnitude of a step and is used for learning rate computation.
When m_ScalesEstimator is set, SetMaximumNewtonStepSizeInPhysicalUnits() may be called to set the maximum step size. If it is not called, m_MaximumNewtonStepSizeInPhysicalUnits defaults to lambda * OptimizerParameterScalesEstimatorTemplate::EstimateMaximumStepSize(), where lambda is in [1,5].
When m_ScalesEstimator is not set, the parameter scales and learning rates defaults to ones, or can be set by users manually.
Definition at line 61 of file itkQuasiNewtonOptimizerv4.h.
|
| virtual::itk::LightObject::Pointer | CreateAnother () const |
| |
| virtual void | EstimateNewtonStepOverSubRange (const IndexRangeType &subrange) |
| |
| virtual const char * | GetNameOfClass () const |
| |
| virtual const DerivativeType & | GetNewtonStep () const |
| |
| virtual void | SetMaximumIterationsWithoutProgress (SizeValueType _arg) |
| |
| virtual void | SetMaximumNewtonStepSizeInPhysicalUnits (TInternalComputationValueType _arg) |
| |
| void | StartOptimization (bool doOnlyInitialization=false) override |
| |
| virtual void | EstimateLearningRate () |
| |
| | itkVirtualGetConstReferenceMacro (ConvergenceValue, TInternalComputationValueType) |
| |
| | itkVirtualSetMacro (ConvergenceWindowSize, SizeValueType) |
| |
| | itkVirtualSetMacro (MinimumConvergenceValue, TInternalComputationValueType) |
| |
| void | ResumeOptimization () override |
| |
| void | StopOptimization () override |
| |
| virtual void | SetLearningRate (TInternalComputationValueType _arg) |
| |
| virtual const TInternalComputationValueType & | GetLearningRate () const |
| |
| virtual void | SetMaximumStepSizeInPhysicalUnits (TInternalComputationValueType _arg) |
| |
| virtual const TInternalComputationValueType & | GetMaximumStepSizeInPhysicalUnits () const |
| |
| virtual void | SetDoEstimateLearningRateAtEachIteration (bool _arg) |
| |
| virtual const bool & | GetDoEstimateLearningRateAtEachIteration () const |
| |
| virtual void | DoEstimateLearningRateAtEachIterationOn () |
| |
| virtual void | DoEstimateLearningRateAtEachIterationOff () |
| |
| virtual void | SetDoEstimateLearningRateOnce (bool _arg) |
| |
| virtual const bool & | GetDoEstimateLearningRateOnce () const |
| |
| virtual void | DoEstimateLearningRateOnceOn () |
| |
| virtual void | DoEstimateLearningRateOnceOff () |
| |
| virtual void | SetReturnBestParametersAndValue (bool _arg) |
| |
| virtual const bool & | GetReturnBestParametersAndValue () const |
| |
| virtual void | ReturnBestParametersAndValueOn () |
| |
| virtual void | ReturnBestParametersAndValueOff () |
| |
| virtual const DerivativeType & | GetGradient () const |
| |
| StopConditionReturnStringType | GetStopConditionDescription () const override |
| |
| | itkVirtualGetConstReferenceMacro (StopCondition, StopConditionObjectToObjectOptimizerEnum) |
| |
| virtual void | ModifyGradientByScales () |
| |
| virtual void | ModifyGradientByLearningRate () |
| |
| virtual bool | CanUseScales () const |
| |
| virtual bool | CanUseScales () const |
| |
| virtual SizeValueType | GetCurrentIteration () const |
| |
| virtual SizeValueType | GetCurrentIteration () const |
| |
| virtual const MeasureType & | GetCurrentMetricValue () const |
| |
| virtual const MeasureType & | GetCurrentMetricValue () const |
| |
| virtual const ParametersType & | GetCurrentPosition () const |
| |
| virtual const ParametersType & | GetCurrentPosition () const |
| |
| virtual const ThreadIdType & | GetNumberOfWorkUnits () const |
| |
| virtual const ThreadIdType & | GetNumberOfWorkUnits () const |
| |
| virtual const ScalesType & | GetScales () const |
| |
| virtual const ScalesType & | GetScales () const |
| |
| virtual const bool & | GetScalesAreIdentity () const |
| |
| virtual const bool & | GetScalesAreIdentity () const |
| |
| bool | GetScalesInitialized () const |
| |
| bool | GetScalesInitialized () const |
| |
| virtual const MeasureType & | GetValue () const |
| |
| virtual const MeasureType & | GetValue () const |
| |
| virtual const ScalesType & | GetWeights () const |
| |
| virtual const ScalesType & | GetWeights () const |
| |
| virtual const bool & | GetWeightsAreIdentity () const |
| |
| virtual const bool & | GetWeightsAreIdentity () const |
| |
| | itkVirtualGetConstMacro (NumberOfIterations, SizeValueType) |
| |
| | itkVirtualGetConstMacro (NumberOfIterations, SizeValueType) |
| |
| | itkVirtualSetMacro (NumberOfIterations, SizeValueType) |
| |
| | itkVirtualSetMacro (NumberOfIterations, SizeValueType) |
| |
| virtual void | SetNumberOfWorkUnits (ThreadIdType number) |
| |
| virtual void | SetNumberOfWorkUnits (ThreadIdType number) |
| |
| virtual void | SetScales (const ScalesType &scales) |
| |
| virtual void | SetScales (const ScalesType &scales) |
| |
| virtual void | SetScalesEstimator (ScalesEstimatorType *_arg) |
| |
| virtual void | SetScalesEstimator (ScalesEstimatorType *_arg) |
| |
| virtual void | SetWeights (ScalesType _arg) |
| |
| virtual void | SetWeights (ScalesType _arg) |
| |
| | itkVirtualSetObjectMacro (Metric, MetricType) |
| |
| virtual MetricType * | GetModifiableMetric () |
| |
| virtual const MetricType * | GetMetric () const |
| |
| | itkVirtualSetObjectMacro (Metric, MetricType) |
| |
| virtual MetricType * | GetModifiableMetric () |
| |
| virtual const MetricType * | GetMetric () const |
| |
| virtual void | SetDoEstimateScales (bool _arg) |
| |
| virtual const bool & | GetDoEstimateScales () const |
| |
| virtual void | DoEstimateScalesOn () |
| |
| virtual void | DoEstimateScalesOff () |
| |
| virtual void | SetDoEstimateScales (bool _arg) |
| |
| virtual const bool & | GetDoEstimateScales () const |
| |
| virtual void | DoEstimateScalesOn () |
| |
| virtual void | DoEstimateScalesOff () |
| |
| unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
| |
| unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
| |
| virtual void | DebugOff () const |
| |
| virtual void | DebugOn () const |
| |
| Command * | GetCommand (unsigned long tag) |
| |
| bool | GetDebug () const |
| |
| MetaDataDictionary & | GetMetaDataDictionary () |
| |
| const MetaDataDictionary & | GetMetaDataDictionary () const |
| |
| virtual ModifiedTimeType | GetMTime () const |
| |
| virtual const TimeStamp & | GetTimeStamp () const |
| |
| bool | HasObserver (const EventObject &event) const |
| |
| void | InvokeEvent (const EventObject &) |
| |
| void | InvokeEvent (const EventObject &) const |
| |
| virtual void | Modified () const |
| |
| void | Register () const override |
| |
| void | RemoveAllObservers () |
| |
| void | RemoveObserver (unsigned long tag) const |
| |
| void | SetDebug (bool debugFlag) const |
| |
| void | SetReferenceCount (int) override |
| |
| void | UnRegister () const noexcept override |
| |
| void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
| |
| void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
| |
| virtual void | SetObjectName (std::string _arg) |
| |
| virtual const std::string & | GetObjectName () const |
| |
| Pointer | Clone () const |
| |
| virtual void | Delete () |
| |
| virtual int | GetReferenceCount () const |
| |
| void | Print (std::ostream &os, Indent indent=0) const |
| |
template<typename TInternalComputationValueType>
Set the maximum step size.
When SetScalesEstimator is called by user, the optimizer will compute learning rates as m_MaximumNewtonStepSizeInPhysicalUnits / m_ScalesEstimator->EstimateStepScale(newtonStep).
If SetMaximumNewtonStepSizeInPhysicalUnits is not called by user, m_MaximumNewtonStepSizeInPhysicalUnits defaults to lambda * m_ScalesEstimator->EstimateMaximumStepSize(),
where EstimateMaximumStepSize returns one voxel spacing and lambda may be in [1,5] according to our experience.