ITK  5.4.0
Insight Toolkit
itkGradientDescentOptimizerv4.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkGradientDescentOptimizerv4_h
19#define itkGradientDescentOptimizerv4_h
20
22
23namespace itk
24{
77template <typename TInternalComputationValueType>
78class ITK_TEMPLATE_EXPORT GradientDescentOptimizerv4Template
79 : public GradientDescentOptimizerBasev4Template<TInternalComputationValueType>
80{
81public:
82 ITK_DISALLOW_COPY_AND_MOVE(GradientDescentOptimizerv4Template);
90
92 itkOverrideGetNameOfClassMacro(GradientDescentOptimizerv4Template);
93
95 itkNewMacro(Self);
96
97
99 using InternalComputationValueType = TInternalComputationValueType;
100
102 using typename Superclass::DerivativeType;
103
105 using typename Superclass::MeasureType;
106 using typename Superclass::IndexRangeType;
107 using typename Superclass::ScalesType;
108 using typename Superclass::ParametersType;
109
114 itkSetMacro(LearningRate, TInternalComputationValueType);
115 itkGetConstReferenceMacro(LearningRate, TInternalComputationValueType);
124 itkSetMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
125 itkGetConstReferenceMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
135 itkSetMacro(DoEstimateLearningRateAtEachIteration, bool);
136 itkGetConstReferenceMacro(DoEstimateLearningRateAtEachIteration, bool);
137 itkBooleanMacro(DoEstimateLearningRateAtEachIteration);
147 itkSetMacro(DoEstimateLearningRateOnce, bool);
148 itkGetConstReferenceMacro(DoEstimateLearningRateOnce, bool);
149 itkBooleanMacro(DoEstimateLearningRateOnce);
161 itkSetMacro(MinimumConvergenceValue, TInternalComputationValueType);
162
171 itkSetMacro(ConvergenceWindowSize, SizeValueType);
172
176 itkGetConstReferenceMacro(ConvergenceValue, TInternalComputationValueType);
177
189 itkSetMacro(ReturnBestParametersAndValue, bool);
190 itkGetConstReferenceMacro(ReturnBestParametersAndValue, bool);
191 itkBooleanMacro(ReturnBestParametersAndValue);
195 void
196 StartOptimization(bool doOnlyInitialization = false) override;
197
199 void
201
203 void
205
207 virtual void
209
210protected:
213 virtual void
215
217 void
219
221 void
223
226
229
230 void
231 PrintSelf(std::ostream & os, Indent indent) const override;
232
233
234 TInternalComputationValueType m_LearningRate{};
235 TInternalComputationValueType m_MinimumConvergenceValue{};
236 TInternalComputationValueType m_ConvergenceValue{};
237
239 MeasureType m_CurrentBestValue{};
240 ParametersType m_BestParameters{};
241
242 bool m_ReturnBestParametersAndValue{ false };
243
249 DerivativeType m_PreviousGradient{};
250
251private:
252};
253
256
257} // end namespace itk
258
259#ifndef ITK_MANUAL_INSTANTIATION
260# include "itkGradientDescentOptimizerv4.hxx"
261#endif
262
263#endif
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType
void StartOptimization(bool doOnlyInitialization=false) override
void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange) override
void ModifyGradientByScalesOverSubRange(const IndexRangeType &subrange) override
void PrintSelf(std::ostream &os, Indent indent) const override
~GradientDescentOptimizerv4Template() override=default
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83