Skip to content

Commit

Permalink
fix bug in poly/NNRay weight randomizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ithanil committed Jul 4, 2019
1 parent bd4f378 commit dd34caf
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/poly/feed/NNRay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,12 @@ void NNRay::randomizeBeta()
std::random_device rdev;
std::mt19937_64 rgen;

// old:
// target sigma to keep sum of weighted inputs in range [-4,4], assuming uniform distribution
// sigma = 8/sqrt(12) = (b-a)/sqrt(12) * m^(1/2)
// const double bah = 4*pow(_sourcePool.size(), -0.5); // (b-a)/2

rgen = std::mt19937_64(rdev());
const double init_sigma = 0.01; // currently we use hard-coded sigma for initial betas
std::normal_distribution<double> rd(init_sigma); // initialize betas to small values
const double init_sigma = sqrt(1./_sources.size()); // beta initialization width guess
std::normal_distribution<double> rd(0., init_sigma);

for (double &b : _beta) {
b = rd(rgen);
}
_beta[0] = 0.; // init offset weight to 0
for (size_t i = 1; i<_sources.size(); ++i) { _beta[i] = rd(rgen); }
}


Expand Down

0 comments on commit dd34caf

Please sign in to comment.