[mlpack-svn] r17477 - mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sun Dec 7 19:58:35 EST 2014
Author: rcurtin
Date: Sun Dec 7 19:58:33 2014
New Revision: 17477
Log:
Add license.
Modified:
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/average_init.hpp
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/average_init.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/average_init.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/average_init.hpp Sun Dec 7 19:58:33 2014
@@ -3,6 +3,21 @@
* @author Sumedh Ghaisas
*
* Intialization rule for Alternating Matrix Factorization.
+ *
+ * This file is part of MLPACK 1.0.11.
+ *
+ * MLPACK is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details (LICENSE.txt).
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * MLPACK. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MLPACK_METHODS_AMF_AVERAGE_INIT_HPP
#define __MLPACK_METHODS_AMF_AVERAGE_INIT_HPP
@@ -13,12 +28,12 @@
namespace amf {
/**
- * This initialization rule initializes matrix W and H to root of average of V
+ * This initialization rule initializes matrix W and H to root of average of V
* with uniform noise. Uniform noise is generated by Armadillo's 'randu' function.
* To have a better effect lower bound of the matrix is subtracted from average
- * before dividing it by the factorization rank. This computed value is added
+ * before dividing it by the factorization rank. This computed value is added
* with the random noise.
- */
+ */
class AverageInitialization
{
public:
@@ -33,7 +48,7 @@
{
size_t n = V.n_rows;
size_t m = V.n_cols;
-
+
double V_avg = 0;
size_t count = 0;
double min = DBL_MAX;
@@ -51,7 +66,7 @@
// Intialize to random values.
W.randu(n, r);
H.randu(r, m);
-
+
W = W + V_avg;
H = H + V_avg;
}
More information about the mlpack-svn
mailing list