Merge branch 'master' of https://github.com/conradsnicta/mlpack into conradsnicta-master

This commit is contained in:
Ryan Curtin
2019-08-29 18:14:31 -04:00
@@ -88,15 +88,20 @@ class ZScoreNormalization
}
// Subtract mean from existing rating and divide it by stddev.
// TODO: consider using spmat::transform() instead of spmat iterators
// TODO: http://arma.sourceforge.net/docs.html#transform
arma::sp_mat::iterator it = cleanedData.begin();
arma::sp_mat::iterator it_end = cleanedData.end();
for (; it != it_end; ++it)
{
*it = (*it - mean) / stddev;
double tmp = (*it - mean) / stddev;
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
if (*it == 0)
*it = std::numeric_limits<double>::min();
if (tmp == 0)
tmp = std::numeric_limits<double>::min();
*it = tmp;
}
}