[mlpack-git] master, mlpack-1.0.x: A better fix for the failing build. (f7d4559)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:46:57 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 f7d45594653ac0385295f5ba861cf5c6e0873f19
Author: Ryan Curtin <ryan at ratml.org>
Date: Sat Apr 19 04:50:23 2014 +0000
A better fix for the failing build.
>---------------------------------------------------------------
f7d45594653ac0385295f5ba861cf5c6e0873f19
.../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).
More information about the mlpack-git
mailing list