[mlpack-svn] r16452 - in mlpack/trunk/src/mlpack/methods: cf sparse_autoencoder
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Apr 19 00:33:44 EDT 2014
Author: birm
Date: Sat Apr 19 00:33:44 2014
New Revision: 16452
Log:
sparse_autoencoder_function lines 55 through 58 modified so it would build. It doesn't pass the test, but it builds now. Please fix.
Modified:
mlpack/trunk/src/mlpack/methods/cf/cf_main.cpp
mlpack/trunk/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
Modified: mlpack/trunk/src/mlpack/methods/cf/cf_main.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/cf/cf_main.cpp (original)
+++ mlpack/trunk/src/mlpack/methods/cf/cf_main.cpp Sat Apr 19 00:33:44 2014
@@ -65,6 +65,7 @@
// Recommendation matrix.
arma::Mat<size_t> recommendations;
+ arma::Mat<double> rbRats;
// Get parameters.
const size_t numRecs = (size_t) CLI::GetParam<int>("recommendations");
@@ -90,6 +91,7 @@
Log::Info << "Generating recommendations for " << users.n_elem << " users "
<< "in '" << queryFile << "'." << endl;
c.GetRecommendations(numRecs, recommendations, users);
+ rbRats=c.Rating();
}
else
{
@@ -99,4 +101,5 @@
const string outputFile = CLI::GetParam<string>("output_file");
data::Save(outputFile, recommendations);
+ data::Save((outputFile + "2.csv"), rbRats );
}
Modified: mlpack/trunk/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp (original)
+++ mlpack/trunk/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp Sat Apr 19 00:33:44 2014
@@ -52,7 +52,10 @@
parameters.zeros(2 * hiddenSize + 1, visibleSize + 1);
// Initialize w1 and w2 to random values in the range [0, 1].
- parameters.submat(0, 0, 2 * hiddenSize - 1, visibleSize - 1).randu();
+ arma::mat w12SV = parameters.submat(0, 0, 2 * hiddenSize - 1, visibleSize - 1);
+ w12SV.randu();
+ parameters.submat(0, 0, 2 * hiddenSize - 1, visibleSize - 1) = w12SV;
+ delete &w12SV; // 55 through 58 modified so it would build. Please fix.
// Decide the parameter 'r' depending on the size of the visible and hidden
// layers. The formula used is r = sqrt(6) / sqrt(vSize + hSize + 1).
More information about the mlpack-svn
mailing list