replace() not supported

This commit is contained in:
Wenhao-H
2018-06-09 12:03:27 +08:00
parent f96be8b37e
commit a33149fa5c
2 changed files with 8 additions and 2 deletions
@@ -38,7 +38,10 @@ class OverallMeanNormalization
data.row(2) -= mean;
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
data.row(2).replace(0, std::numeric_limits<double>::min());
data.row(2).for_each([](double& x) {
if (x == 0)
x = std::numeric_limits<double>::min();
});
}
/**
@@ -46,7 +46,10 @@ class ZScoreNormalization
data.row(2) = (data.row(2) - mean) / stddev;
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
data.row(2).replace(0, std::numeric_limits<double>::min());
data.row(2).for_each([](double& x) {
if (x == 0)
x = std::numeric_limits<double>::min();
});
}
/**