[mlpack-svn] r15868 - mlpack/trunk/src/mlpack/methods/cf
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Sep 30 13:17:42 EDT 2013
Author: rcurtin
Date: Mon Sep 30 13:17:42 2013
New Revision: 15868
Log:
Why not call CleanData() in the constructor instead of repeatedly in other parts
of the implementation?
Modified:
mlpack/trunk/src/mlpack/methods/cf/cf.cpp
Modified: mlpack/trunk/src/mlpack/methods/cf/cf.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/cf/cf.cpp (original)
+++ mlpack/trunk/src/mlpack/methods/cf/cf.cpp Mon Sep 30 13:17:42 2013
@@ -27,6 +27,8 @@
Log::Info<<"Constructor (param: input data, default: numRecs;neighbourhood)"<<endl;
this->numRecs = 5;
this->numUsersForSimilarity = 5;
+
+ CleanData();
}
CF::CF(const size_t numRecs,arma::mat& data) :
@@ -43,6 +45,8 @@
else
this->numRecs = numRecs;
this->numUsersForSimilarity = 5;
+
+ CleanData();
}
CF::CF(const size_t numRecs, const size_t numUsersForSimilarity,
@@ -69,14 +73,13 @@
}
else
this->numUsersForSimilarity = numUsersForSimilarity;
+
+ CleanData();
}
void CF::CalculateApproximateRatings()
{
Log::Info<<"CalculatineApproximateRating"<<endl;
- //Build the initial rating tables with missing values
- //if(cleanedData.n_rows==0)
- CleanData();
//Decompose the size_tiial table size_to user and item
Decompose();
//Generate new table by multiplying approximate values
@@ -85,8 +88,6 @@
void CF::GetRecommendations(arma::Mat<size_t>& recommendations)
{
- // Build the initial rating tables with missing values.
- CleanData();
// Used to save user IDs.
arma::Col<size_t> users =
arma::zeros<arma::Col<size_t> >(cleanedData.n_cols, 1);
More information about the mlpack-svn
mailing list