[mlpack] 02/04: A better fix for the failing build.

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 57b9bada594752b6e61fb6bb189b01d84959be97
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Sat Apr 19 04:50:23 2014 +0000

    A better fix for the failing build.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16453 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 .../sparse_autoencoder/sparse_autoencoder_function.cpp       | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp b/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
index dab3a28..229060a 100644
--- a/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
+++ b/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.cpp
@@ -48,14 +48,12 @@ const arma::mat SparseAutoencoderFunction::InitializeWeights()
   // 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).

-- 
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