13 #ifndef MLPACK_METHODS_CF_NORMALIZATION_COMBINED_NORMALIZATION_HPP
14 #define MLPACK_METHODS_CF_NORMALIZATION_COMBINED_NORMALIZATION_HPP
43 template<
typename... NormalizationTypes>
47 using TupleType = std::tuple<NormalizationTypes...>;
57 template<
typename MatType>
60 SequenceNormalize<0>(data);
74 const double rating)
const
76 return SequenceDenormalize<0>(user, item, rating);
88 arma::vec& predictions)
const
90 SequenceDenormalize<0>(combinations, predictions);
98 return normalizations;
104 template<
typename Archive>
107 SequenceSerialize<0, Archive>(ar, version);
119 void SequenceNormalize(MatType& data)
121 std::get<I>(normalizations).Normalize(data);
122 SequenceNormalize<I + 1>(data);
131 void SequenceNormalize(MatType& ) { }
137 double SequenceDenormalize(
const size_t user,
139 const double rating)
const
143 double realRating = SequenceDenormalize<I + 1>(user, item, rating);
145 std::get<I>(normalizations).Denormalize(user, item, realRating);
154 double SequenceDenormalize(
const size_t ,
156 const double rating)
const
165 void SequenceDenormalize(
const arma::Mat<size_t>& combinations,
166 arma::vec& predictions)
const
170 SequenceDenormalize<I+1>(combinations, predictions);
171 std::get<I>(normalizations).Denormalize(combinations, predictions);
179 void SequenceDenormalize(
const arma::Mat<size_t>& ,
180 arma::vec& )
const { }
187 void SequenceSerialize(Archive& ar,
const unsigned int version)
189 std::string tagName =
"normalization_";
190 tagName += std::to_string(I);
191 ar & boost::serialization::make_nvp(
192 tagName.c_str(), std::get<I>(normalizations));
193 SequenceSerialize<I + 1, Archive>(ar, version);
202 void SequenceSerialize(Archive& ,
const unsigned int )