[mlpack-svn] r16453 - mlpack/trunk/src/mlpack/methods/sparse_autoencoder

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Apr 19 00:50:23 EDT 2014


Author: rcurtin
Date: Sat Apr 19 00:50:23 2014
New Revision: 16453

Log:
A better fix for the failing build.


Modified:
   mlpack/trunk/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp

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:50:23 2014
@@ -48,14 +48,12 @@
   // compared to the matrix size. The above structure allows for smooth matrix
   // operations without making the code too ugly.
 
+  // Initialize w1 and w2 to random values in the range [0, 1], then set b1 and
+  // b2 to 0.
   arma::mat parameters;
-  parameters.zeros(2 * hiddenSize + 1, visibleSize + 1);
-
-  // Initialize w1 and w2 to random values in the range [0, 1].
-  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.
+  parameters.randu(2 * hiddenSize + 1, visibleSize + 1);
+  parameters.row(2 * hiddenSize).zeros();
+  parameters.col(visibleSize).zeros();
 
   // 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