[mlpack] 01/04: sparse_autoencoder_function lines 55 through 58 modified so it would build. It doesn't pass the test, but it builds now. Please fix.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Fri May 9 08:38:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 9df358a68940972d61a66b0ffb3ff550efb37114
Author: birm <birm at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Sat Apr 19 04:33:44 2014 +0000

    sparse_autoencoder_function lines 55 through 58 modified so it would build. It doesn't pass the test, but it builds now. Please fix.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16452 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/cf/cf_main.cpp                                    | 3 +++
 .../methods/sparse_autoencoder/sparse_autoencoder_function.cpp       | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp
index 7c873d4..4efd2c9 100644
--- a/src/mlpack/methods/cf/cf_main.cpp
+++ b/src/mlpack/methods/cf/cf_main.cpp
@@ -65,6 +65,7 @@ int main(int argc, char** argv)
 
   // 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 @@ int main(int argc, char** argv)
     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 @@ int main(int argc, char** argv)
 
   const string outputFile = CLI::GetParam<string>("output_file");
   data::Save(outputFile, recommendations);
+  data::Save((outputFile + "2.csv"), rbRats );
 }
diff --git a/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp b/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
index 09505ae..dab3a28 100644
--- a/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
+++ b/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
@@ -52,7 +52,10 @@ const arma::mat SparseAutoencoderFunction::InitializeWeights()
   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).

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list