Merge branch 'conradsnicta-master'
This commit is contained in:
@@ -33,6 +33,9 @@
|
||||
|
||||
* Improve KDE pruning by reclaiming not used error tolerance (#1954, #1984).
|
||||
|
||||
* Optimizations for sparse matrix accesses in z-score normalization for CF
|
||||
(#1989).
|
||||
|
||||
### mlpack 3.1.1
|
||||
###### 2019-05-26
|
||||
* Fix random forest bug for numerical-only data (#1887).
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user