Skip to content

Commit eb11f54

Browse files
committed
STYLE: Remove sigma4factor from StochasticGradientDescent Optimizers
The local variable `sigma4factor` has been equal to `1.0` for more than 16 years. (Starting with commit a90c96a, 16 Jan 2008).
1 parent 3210653 commit eb11f54

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Components/Optimizers/AdaptiveStochasticGradientDescent/elxAdaptiveStochasticGradientDescent.hxx

+5-7
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,12 @@ AdaptiveStochasticGradientDescent<TElastix>::AutomaticParameterEstimationOrigina
575575
}
576576

577577
/** Measure square magnitude of exact gradient and approximation error. */
578-
const double sigma4factor = 1.0;
579-
double sigma4 = 0.0;
580-
double gg = 0.0;
581-
double ee = 0.0;
578+
double sigma4 = 0.0;
579+
double gg = 0.0;
580+
double ee = 0.0;
582581
if (maxJJ > 1e-14)
583582
{
584-
sigma4 = sigma4factor * delta / std::sqrt(maxJJ);
583+
sigma4 = delta / std::sqrt(maxJJ);
585584
}
586585
this->SampleGradients(this->GetScaledCurrentPosition(), sigma4, gg, ee);
587586
timer3.Stop();
@@ -709,7 +708,6 @@ AdaptiveStochasticGradientDescent<TElastix>::AutomaticParameterEstimationUsingDi
709708
double sigma4 = 0.0;
710709
double gg = 0.0;
711710
double ee = 0.0;
712-
double sigma4factor = 1.0;
713711

714712
/** Sample the grid and random sampler container to estimate the noise factor. */
715713
if (this->m_NumberOfGradientMeasurements == 0)
@@ -722,7 +720,7 @@ AdaptiveStochasticGradientDescent<TElastix>::AutomaticParameterEstimationUsingDi
722720
timer5.Start();
723721
if (maxJJ > 1e-14)
724722
{
725-
sigma4 = sigma4factor * delta / std::sqrt(maxJJ);
723+
sigma4 = delta / std::sqrt(maxJJ);
726724
}
727725
this->SampleGradients(this->GetScaledCurrentPosition(), sigma4, gg, ee);
728726

Components/Optimizers/PreconditionedStochasticGradientDescent/elxPreconditionedStochasticGradientDescent.hxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,11 @@ PreconditionedStochasticGradientDescent<TElastix>::AutomaticPreconditionerEstima
637637
/** Sample the fixed image to estimate the noise factor. */
638638
itk::TimeProbe timer_noise;
639639
timer_noise.Start();
640-
double sigma4factor = 1.0;
641640
double sigma4 = 0.0;
642641
log::info(std::ostringstream{} << " The estimated MaxJJ is: " << maxJJ);
643642
if (maxJJ > 1e-14)
644643
{
645-
sigma4 = sigma4factor * this->m_MaximumStepLength / std::sqrt(maxJJ);
644+
sigma4 = this->m_MaximumStepLength / std::sqrt(maxJJ);
646645
}
647646
double gg = 0.0;
648647
double ee = 0.0;

0 commit comments

Comments
 (0)