1. When estimating the step_sizes, why do you do the standardization(by using "normalizer") to make the square sum of the step_sizes equal to the number of parameters? The relevant code is
if (step_size_sq_sum > 0.0) {
_x_sum_n = 0;
double normalizer = sqrt((double)_step_sizes.size())
/ sqrt(step_size_sq_sum);
for (size_t i = 0; i < _step_sizes.size(); i++)
_step_sizes[i] *= normalizer;
}
2. In each iteration, when calculating _x_sum and _xsq_sum. You are not only using the final result of the parameters. Instead, you use "nvalid" to judge whether or not to add the "newx", (as the annotation says, you "update running statistics if point is in slice") such that during each iteration, you may get several "newx". Why do you do this? The relevant code is
if (nvalid) {
_x_sum_n++;
for (size_t i = 0; i < newx.size(); i++) {
_x_sum[i] += newx[i];
_xsq_sum[i] += newx[i] * newx[i];
}
}
Thank you for your help!