On macOS double-precision serialization is not lossless, so switch to float.

This commit is contained in:
Marcus Edel
2019-09-01 19:48:06 +02:00
parent d4c53ec546
commit 4e8bb575b6
5 changed files with 10 additions and 10 deletions
@@ -119,7 +119,7 @@ class CombinedNormalization
void SequenceNormalize(MatType& data)
{
std::get<I>(normalizations).Normalize(data);
SequenceNormalize<I+1>(data);
SequenceNormalize<I + 1>(data);
}
//! End of tuple unpacking.
@@ -140,7 +140,7 @@ class CombinedNormalization
{
// The order of denormalization should be the reversed order
// of normalization.
double realRating = SequenceDenormalize<I+1>(user, item, rating);
double realRating = SequenceDenormalize<I + 1>(user, item, rating);
realRating =
std::get<I>(normalizations).Denormalize(user, item, realRating);
return realRating;
@@ -190,7 +190,7 @@ class CombinedNormalization
tagName += std::to_string(I);
ar & boost::serialization::make_nvp(
tagName.c_str(), std::get<I>(normalizations));
SequenceSerialize<I+1, Archive>(ar, version);
SequenceSerialize<I + 1, Archive>(ar, version);
}
//! End of tuple unpacking.
@@ -78,7 +78,7 @@ class ItemMeanNormalization
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
if (datapoint(2) == 0)
datapoint(2) = std::numeric_limits<double>::min();
datapoint(2) = std::numeric_limits<float>::min();
});
}
@@ -114,7 +114,7 @@ class ItemMeanNormalization
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
if (tmp == 0)
tmp = std::numeric_limits<double>::min();
tmp = std::numeric_limits<float>::min();
*it = tmp;
}
@@ -114,7 +114,7 @@ class UserMeanNormalization
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
if (tmp == 0)
tmp = std::numeric_limits<double>::min();
tmp = std::numeric_limits<float>::min();
*it = tmp;
}
@@ -64,7 +64,7 @@ class ZScoreNormalization
data.row(2).for_each([](double& x)
{
if (x == 0)
x = std::numeric_limits<double>::min();
x = std::numeric_limits<float>::min();
});
}
@@ -99,7 +99,7 @@ class ZScoreNormalization
// The algorithm omits rating of zero. If normalized rating equals zero,
// it is set to the smallest positive double value.
if (tmp == 0)
tmp = std::numeric_limits<double>::min();
tmp = std::numeric_limits<float>::min();
*it = tmp;
}
+2 -2
View File
@@ -702,7 +702,7 @@ BOOST_AUTO_TEST_CASE(RecommendationAccuracySVDCompleteTest)
/**
* Make sure recommendations that are generated are reasonably accurate
* for SVD Incomplete Incremental method.
*/
*/
BOOST_AUTO_TEST_CASE(RecommendationAccuracySVDIncompleteTest)
{
RecommendationAccuracy<SVDIncompletePolicy>();
@@ -711,7 +711,7 @@ BOOST_AUTO_TEST_CASE(RecommendationAccuracySVDIncompleteTest)
/**
* Make sure recommendations that are generated are reasonably accurate
* for Bias SVD method.
*/
*/
BOOST_AUTO_TEST_CASE(RecommendationAccuracyBiasSVDTest)
{
RecommendationAccuracy<BiasSVDPolicy>();