From 2208caf0ca1e2ee4c88110fd42813dd303fd1591 Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:15:54 +0530 Subject: [PATCH 1/9] Followed guidelines to update syntax (yet again..) Followed guidelines to update syntax (yet again..) --- src/mlpack/methods/cf/cf_main.cpp | 371 ++++++++++++------------ src/mlpack/methods/cf/cf_model.hpp | 12 +- src/mlpack/methods/cf/cf_model_impl.hpp | 50 ++-- 3 files changed, 214 insertions(+), 219 deletions(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index 8aba9a8673..d0ef294307 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -134,165 +134,160 @@ PARAM_INT_IN("recommendations", "Number of recommendations to generate for each" PARAM_INT_IN("seed", "Set the random seed (0 uses std::time(NULL)).", "s", 0); -// Interpolation and Neighbour Search Algorithms +// Interpolation and Neighbor Search Algorithms PARAM_STRING_IN("interpolation", "Algorithm used for weight interpolation.", "i", "Average"); -PARAM_STRING_IN("neighbour_search", "Algorithm used for neighbour search.", +PARAM_STRING_IN("neighbor_search", "Algorithm used for neighbor search.", "f", "Euclidean"); void ComputeRecommendations(CFModel* cf, const size_t numRecs, arma::Mat& recommendations) { - const string ns_algo = CLI::GetParam("neighbour_search"); - const string iw_algo = CLI::GetParam("interpolation"); - - // Reading users. - if (CLI::HasParam("query")) - { - // User matrix. - arma::Mat users = + // Taking alternatives + const string neighborSearchAlgorithm = CLI::GetParam + ("neighbor_search"); + const string interpolationAlgorithm = CLI::GetParam("interpolation"); + + if (CLI::HasParam("query")) + { + // User matrix. + arma::Mat users = std::move(CLI::GetParam>("query")); - if (users.n_rows > 1) - users = users.t(); - if (users.n_rows > 1) - Log::Fatal << "List of query users must be one-dimensional!" << std::endl; + if (users.n_rows > 1) + users = users.t(); + if (users.n_rows > 1) + Log::Fatal << "List of query users must be one-dimensional!" + << std::endl; - Log::Info << "Generating recommendations for " << users.n_elem << " users." - << endl; + Log::Info << "Generating recommendations for " + << users.n_elem << " users." + << endl; - // Making All the possible paths - if (ns_algo == "Cosine") - { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - } - else if (ns_algo == "Euclidean") - { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - } - else if (ns_algo == "Pearson") - { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations, - users.row(0).t()); - } - } - } - else - { - Log::Info << "Generating recommendations for all users." << endl; - if (ns_algo == "Cosine") + // All possible alternatives for Recommendations + if (neighborSearchAlgorithm == "Cosine") { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations); - } + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } } - else if (ns_algo == "Euclidean") + else if (neighborSearchAlgorithm == "Euclidean") { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations); - } + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } } - else if (ns_algo == "Pearson") + else if (neighborSearchAlgorithm == "Pearson") { - if (iw_algo == "Average") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Regression") - { - cf->GetRecommendations(numRecs, recommendations); - } - else if (iw_algo == "Similarity") - { - cf->GetRecommendations(numRecs, recommendations); - } + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } } - } + } + else + { + Log::Info << "Generating recommendations for all users." << endl; + if (neighborSearchAlgorithm == "Cosine") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + else if (neighborSearchAlgorithm == "Euclidean") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + else if (neighborSearchAlgorithm == "Pearson") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + } + } void ComputeRMSE(CFModel* cf) { - // Interpolation and Neighbour Search + // Interpolation and Neighbor Search - const string ns_algo = CLI::GetParam("neighbour_search"); - const string iw_algo = CLI::GetParam("interpolation"); + const string neighborSearchAlgorithm = CLI::GetParam("neighbor_search"); + const string interpolationAlgorithm = CLI::GetParam("interpolation"); // Now, compute each test point. arma::mat testData = std::move(CLI::GetParam("test")); @@ -308,59 +303,59 @@ void ComputeRMSE(CFModel* cf) // Now compute the RMSE. arma::vec predictions; - if (ns_algo == "Cosine") + if (neighborSearchAlgorithm == "Cosine") { - if (iw_algo == "Average") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Regression") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Similarity") - { - cf->Predict(combinations, predictions); - } + if (interpolationAlgorithm == "Average") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Regression") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->Predict + (combinations, predictions); + } } - else if (ns_algo == "Euclidean") + else if (neighborSearchAlgorithm == "Euclidean") { - if (iw_algo == "Average") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Regression") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Similarity") - { - cf->Predict(combinations, predictions); - } + if (interpolationAlgorithm == "Average") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Regression") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->Predict + (combinations, predictions); + } } - else if (ns_algo == "Pearson") + else if (neighborSearchAlgorithm == "Pearson") { - if (iw_algo == "Average") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Regression") - { - cf->Predict(combinations, predictions); - } - else if (iw_algo == "Similarity") - { - cf->Predict(combinations, predictions); - } + if (interpolationAlgorithm == "Average") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Regression") + { + cf->Predict + (combinations, predictions); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->Predict + (combinations, predictions); + } } // Compute the root of the sum of the squared errors, divide by the number of @@ -403,7 +398,7 @@ void PerformAction(arma::mat& dataset, const size_t neighborhood = (size_t) CLI::GetParam("neighborhood"); CFModel* c = new CFModel(); c->template Train(dataset, neighborhood, rank, - maxIterations, minResidue, CLI::HasParam("iteration_only_termination")); + maxIterations, minResidue, CLI::HasParam("iteration_only_termination")); PerformAction(c); } @@ -482,12 +477,12 @@ static void mlpackMain() "SVDIncompleteIncremental", "SVDCompleteIncremental", "RegSVD", "RandSVD", "BiasSVD", "SVDPP" }, true, "unknown algorithm"); - // Validate the interpolation and neighbour_search policy + // Validate the interpolation and neighbor_search policy RequireParamInSet("interpolation", { "Average", "Regression", "Similarity" }, true, "unknown interpolation algorithm"); - RequireParamInSet("neighbour_search", { "Cosine", - "Euclidean", "Pearson" }, true, "unknown neighbour search algorithm"); + RequireParamInSet("neighbor_search", { "Cosine", + "Euclidean", "Pearson" }, true, "unknown neighbor search algorithm"); ReportIgnoredParam({{ "iteration_only_termination", true }}, "min_residue"); diff --git a/src/mlpack/methods/cf/cf_model.hpp b/src/mlpack/methods/cf/cf_model.hpp index ae568e371d..ef1ebac214 100644 --- a/src/mlpack/methods/cf/cf_model.hpp +++ b/src/mlpack/methods/cf/cf_model.hpp @@ -54,7 +54,7 @@ class GetValueVisitor : public boost::static_visitor * PredictVisitor uses the CFType object to make predictions on the given * combinations of users and items. */ -template class PredictVisitor : public boost::static_visitor { @@ -78,7 +78,7 @@ class PredictVisitor : public boost::static_visitor * RecommendationVisitor uses the CFType object to get recommendations for the * given users. */ -template class RecommendationVisitor : public boost::static_visitor { @@ -146,21 +146,21 @@ class CFModel const bool mit); //! Make predictions. - template void Predict(const arma::Mat& combinations, arma::vec& predictions); //! Compute recommendations for query users. - template void GetRecommendations(const size_t numRecs, arma::Mat& recommendations, const arma::Col& users); //! Compute recommendations for all users. - template + template void GetRecommendations(const size_t numRecs, arma::Mat& recommendations); diff --git a/src/mlpack/methods/cf/cf_model_impl.hpp b/src/mlpack/methods/cf/cf_model_impl.hpp index b503f5f868..8103feed64 100644 --- a/src/mlpack/methods/cf/cf_model_impl.hpp +++ b/src/mlpack/methods/cf/cf_model_impl.hpp @@ -34,19 +34,19 @@ void* GetValueVisitor::operator()(CFType* c) const return (void*) c; } -template -PredictVisitor::PredictVisitor( +PredictVisitor::PredictVisitor( const arma::Mat& combinations, arma::vec& predictions) : combinations(combinations), predictions(predictions) { } -template template -void PredictVisitor +void PredictVisitor ::operator()(CFType* c) const { if (!c) @@ -55,13 +55,13 @@ void PredictVisitor return; } - c->template Predicttemplate Predict(combinations, predictions); } -template -RecommendationVisitor +RecommendationVisitor ::RecommendationVisitor( const size_t numRecs, arma::Mat& recommendations, @@ -73,10 +73,10 @@ RecommendationVisitor usersGiven(usersGiven) { } -template +template template -void RecommendationVisitor +void RecommendationVisitor ::operator()(CFType* c) const { if (!c) @@ -86,11 +86,11 @@ void RecommendationVisitor } if (usersGiven) - c->template GetRecommendations(numRecs, recommendations, users); + c->template GetRecommendations + (numRecs, recommendations, users); else - c->template GetRecommendations(numRecs, recommendations); + c->template GetRecommendations + (numRecs, recommendations); } CFModel::~CFModel() @@ -117,37 +117,37 @@ void CFModel::Train(const MatType& data, } //! Make predictions. -template void CFModel::Predict(const arma::Mat& combinations, arma::vec& predictions) { - PredictVisitor predict(combinations, predictions); + PredictVisitor + predict(combinations, predictions); boost::apply_visitor(predict, cf); } //! Compute recommendations for queried users. -template +template void CFModel::GetRecommendations(const size_t numRecs, arma::Mat& recommendations, const arma::Col& users) { - RecommendationVisitor recommendation(numRecs, recommendations, users, true); + RecommendationVisitor + recommendation(numRecs, recommendations, users, true); boost::apply_visitor(recommendation, cf); } //! Compute recommendations for all users. -template +template void CFModel::GetRecommendations(const size_t numRecs, arma::Mat& recommendations) { arma::Col users; - RecommendationVisitor recommendation(numRecs, recommendations, users, false); + RecommendationVisitor + recommendation(numRecs, recommendations, users, false); boost::apply_visitor(recommendation, cf); } From 5260c234d6e7728177c521ba72b7fbd92b8c74f2 Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:17:49 +0530 Subject: [PATCH 2/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index d0ef294307..57402794d0 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -150,6 +150,7 @@ void ComputeRecommendations(CFModel* cf, ("neighbor_search"); const string interpolationAlgorithm = CLI::GetParam("interpolation"); + // Reading users. if (CLI::HasParam("query")) { // User matrix. From 02181090d5f73b4a6f21acc583ebb6347fe601cb Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:22:48 +0530 Subject: [PATCH 3/9] Add files via upload --- src/mlpack/methods/cf/cf_main.cpp | 239 +++++++++++++++--------------- 1 file changed, 119 insertions(+), 120 deletions(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index 57402794d0..aceda6c746 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -149,138 +149,137 @@ void ComputeRecommendations(CFModel* cf, const string neighborSearchAlgorithm = CLI::GetParam ("neighbor_search"); const string interpolationAlgorithm = CLI::GetParam("interpolation"); - - // Reading users. - if (CLI::HasParam("query")) - { - // User matrix. - arma::Mat users = - std::move(CLI::GetParam>("query")); - if (users.n_rows > 1) - users = users.t(); - if (users.n_rows > 1) + + // Reading users. + if (CLI::HasParam("query")) + { + // User matrix. + arma::Mat users = + std::move(CLI::GetParam>("query")); + if (users.n_rows > 1) + users = users.t(); + if (users.n_rows > 1) Log::Fatal << "List of query users must be one-dimensional!" << std::endl; - Log::Info << "Generating recommendations for " - << users.n_elem << " users." - << endl; + Log::Info << "Generating recommendations for " + << users.n_elem << " users." + << endl; - // All possible alternatives for Recommendations - if (neighborSearchAlgorithm == "Cosine") - { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - } - else if (neighborSearchAlgorithm == "Euclidean") - { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - } - else if (neighborSearchAlgorithm == "Pearson") - { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations, users.row(0).t()); - } - } - } - else + // All possible alternatives for Recommendations + if (neighborSearchAlgorithm == "Cosine") { - Log::Info << "Generating recommendations for all users." << endl; - if (neighborSearchAlgorithm == "Cosine") + if (interpolationAlgorithm == "Average") { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations); - } + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); } - else if (neighborSearchAlgorithm == "Euclidean") + else if (interpolationAlgorithm == "Regression") { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations); - } + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); } - else if (neighborSearchAlgorithm == "Pearson") + else if (interpolationAlgorithm == "Similarity") { - if (interpolationAlgorithm == "Average") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Regression") - { - cf->GetRecommendations - (numRecs, recommendations); - } - else if (interpolationAlgorithm == "Similarity") - { - cf->GetRecommendations - (numRecs, recommendations); - } + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); } } - + else if (neighborSearchAlgorithm == "Euclidean") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + } + else if (neighborSearchAlgorithm == "Pearson") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations, users.row(0).t()); + } + } + } + else + { + Log::Info << "Generating recommendations for all users." << endl; + if (neighborSearchAlgorithm == "Cosine") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + else if (neighborSearchAlgorithm == "Euclidean") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + else if (neighborSearchAlgorithm == "Pearson") + { + if (interpolationAlgorithm == "Average") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Regression") + { + cf->GetRecommendations + (numRecs, recommendations); + } + else if (interpolationAlgorithm == "Similarity") + { + cf->GetRecommendations + (numRecs, recommendations); + } + } + } } void ComputeRMSE(CFModel* cf) From 7706237dd12f8b67c73df3a5f74501605598fdc8 Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:33:07 +0530 Subject: [PATCH 4/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index aceda6c746..5b09825c8a 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -155,7 +155,7 @@ void ComputeRecommendations(CFModel* cf, { // User matrix. arma::Mat users = - std::move(CLI::GetParam>("query")); + std::move(CLI::GetParam>("query")); if (users.n_rows > 1) users = users.t(); if (users.n_rows > 1) From 7e3f29f7c0067b9df1de6d1064c2580dc04c4c52 Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:34:48 +0530 Subject: [PATCH 5/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index 5b09825c8a..6f0f3b1534 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -159,8 +159,8 @@ void ComputeRecommendations(CFModel* cf, if (users.n_rows > 1) users = users.t(); if (users.n_rows > 1) - Log::Fatal << "List of query users must be one-dimensional!" - << std::endl; + Log::Fatal << "List of query users must be one-dimensional!" + << std::endl; Log::Info << "Generating recommendations for " << users.n_elem << " users." From 274ae474130effc5c768b4eebc4c304a9c0a701e Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:37:45 +0530 Subject: [PATCH 6/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index 6f0f3b1534..709dd93bee 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -285,7 +285,6 @@ void ComputeRecommendations(CFModel* cf, void ComputeRMSE(CFModel* cf) { // Interpolation and Neighbor Search - const string neighborSearchAlgorithm = CLI::GetParam("neighbor_search"); const string interpolationAlgorithm = CLI::GetParam("interpolation"); From 858b70bc431c1ffa1a18209e297f359218b5071e Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:43:22 +0530 Subject: [PATCH 7/9] Update cf_model_impl.hpp --- src/mlpack/methods/cf/cf_model_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/cf/cf_model_impl.hpp b/src/mlpack/methods/cf/cf_model_impl.hpp index 8103feed64..aff6beeb11 100644 --- a/src/mlpack/methods/cf/cf_model_impl.hpp +++ b/src/mlpack/methods/cf/cf_model_impl.hpp @@ -36,7 +36,7 @@ void* GetValueVisitor::operator()(CFType* c) const template -PredictVisitor::PredictVisitor( +PredictVisitor::PredictVisitor( const arma::Mat& combinations, arma::vec& predictions) : combinations(combinations), From 23d2431e863dfe8f5b55b47c3a70dba2175c290a Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:46:54 +0530 Subject: [PATCH 8/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index 709dd93bee..b29c6346ed 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -397,7 +397,7 @@ void PerformAction(arma::mat& dataset, const size_t neighborhood = (size_t) CLI::GetParam("neighborhood"); CFModel* c = new CFModel(); c->template Train(dataset, neighborhood, rank, - maxIterations, minResidue, CLI::HasParam("iteration_only_termination")); + maxIterations, minResidue, CLI::HasParam("iteration_only_termination")); PerformAction(c); } From 3c86c2589db067ed764e3b7d46e5eae1c322659e Mon Sep 17 00:00:00 2001 From: AYESDIE <34449856+AYESDIE@users.noreply.github.com> Date: Thu, 25 Oct 2018 13:59:04 +0530 Subject: [PATCH 9/9] Update cf_main.cpp --- src/mlpack/methods/cf/cf_main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp index b29c6346ed..add5df5f90 100644 --- a/src/mlpack/methods/cf/cf_main.cpp +++ b/src/mlpack/methods/cf/cf_main.cpp @@ -80,6 +80,18 @@ PROGRAM_INFO("Collaborative Filtering", "This program performs collaborative " " - 'SVDCompleteIncremental' -- SVD complete incremental learning\n" " - 'BiasSVD' -- Bias SVD using a SGD optimizer\n" " - 'SVDPP' -- SVD++ using a SGD optimizer\n" + "\n\n" + "The following neighbor search algorithms can be specified via" + + " the " + PRINT_PARAM_STRING("neighbor_search") + " parameter:" + " - 'Cosine' -- Cosine Search Algorithm\n" + " - 'Euclidean' -- Euclidean Search Algorithm\n" + " - 'Pearson' -- Pearson Search Algorithm\n" + "\n\n" + "The following weight interpolation algorithms can be specified via" + + " the " + PRINT_PARAM_STRING("interpolation") + " parameter:" + " - 'Average' -- Average Interpolation Algorithm\n" + " - 'Regression' -- Regression Interpolation Algorithm\n" + " - 'Similarity' -- Similarity Interpolation Algorithm\n" "\n" "A trained model may be saved to with the " + PRINT_PARAM_STRING("output_model") + " output parameter."