[mlpack-git] master, mlpack-1.0.x: sparse_autoencoder_function lines 55 through 58 modified so it would build. It doesn't pass the test, but it builds now. Please fix. (adc6dfb)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:46:55 EST 2015


Repository : https://github.com/mlpack/mlpack

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit adc6dfbaf5e112904dba1b43cea1a353bfebfb0d
Author: birm <birm at gatech.edu>
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.


>---------------------------------------------------------------

adc6dfbaf5e112904dba1b43cea1a353bfebfb0d
 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).



More information about the mlpack-git mailing list