[mlpack-svn] r17456 - in mlpack/tags/mlpack-1.0.11: . doc/tutorials doc/tutorials/amf src/mlpack/methods/amf src/mlpack/methods/amf/init_rules src/mlpack/methods/amf/termination_policies src/mlpack/methods/amf/update_rules
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sun Dec 7 14:26:17 EST 2014
Author: rcurtin
Date: Sun Dec 7 14:26:16 2014
New Revision: 17456
Log:
Backport documentation from r17014 (surprised this wasn't in 1.0.10).
Added:
mlpack/tags/mlpack-1.0.11/doc/tutorials/amf/
- copied from r17093, /mlpack/trunk/doc/tutorials/amf/
Modified:
mlpack/tags/mlpack-1.0.11/ (props changed)
mlpack/tags/mlpack-1.0.11/doc/tutorials/tutorials.txt
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/amf.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/random_acol_init.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_als.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp
mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp
Modified: mlpack/tags/mlpack-1.0.11/doc/tutorials/tutorials.txt
==============================================================================
--- mlpack/tags/mlpack-1.0.11/doc/tutorials/tutorials.txt (original)
+++ mlpack/tags/mlpack-1.0.11/doc/tutorials/tutorials.txt Sun Dec 7 14:26:16 2014
@@ -31,5 +31,5 @@
- \ref kmtutorial
- \ref fmkstutorial
- \ref emst_tutorial
-
+ - \ref amftutorial
*/
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/amf.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/amf.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/amf.hpp Sun Dec 7 14:26:16 2014
@@ -4,6 +4,8 @@
* @author Mohan Rajendran
* @author Ryan Curtin
*
+ * Alternating Matrix Factorization
+ *
* The AMF (alternating matrix factorization) class, from which more commonly
* known techniques such as incremental SVD, NMF, and batch-learning SVD can be
* derived.
@@ -32,7 +34,7 @@
#include <mlpack/methods/amf/termination_policies/simple_residue_termination.hpp>
namespace mlpack {
-namespace amf {
+namespace amf /** Alternating Matrix Factorization **/ {
/**
* This class implements AMF (alternating matrix factorization) on the given
@@ -69,7 +71,7 @@
* @tparam UpdateRule The update rule for calculating W and H matrix at each
* iteration.
*
- * @see NMF_MultiplicativeDistanceUpdate
+ * @see NMFMultiplicativeDistanceUpdate, SimpleResidueTermination
*/
template<typename TerminationPolicyType = SimpleResidueTermination,
typename InitializationRuleType = RandomInitialization,
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/random_acol_init.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/random_acol_init.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/init_rules/random_acol_init.hpp Sun Dec 7 14:26:16 2014
@@ -2,11 +2,7 @@
* @file random_acol_init.hpp
* @author Mohan Rajendran
*
- * Intialization rule for Non-Negative Matrix Factorization. This simple
- * initialization is performed by the random Acol initialization introduced in
- * the paper 'Algorithms, Initializations and Convergence' by Langville et al.
- * This method sets each of the columns of W by averaging p randomly chosen
- * columns of V.
+ * Intialization rule for Alternating Matrix Factorization.
*
* This file is part of MLPACK 1.0.10.
*
@@ -32,9 +28,11 @@
namespace amf {
/**
- * This class initializes the W matrix of the NMF algorithm by averaging p
+ * This class initializes the W matrix of the AMF algorithm by averaging p
* randomly chosen columns of V. In this case, p is a template parameter. H is
- * then set randomly.
+ * then set randomly This simple initialization is performed by the random
+ * Acol initialization introduced in the paper 'Algorithms, Initializations and
+ * Convergence' by Langville et al.
*
* @tparam The number of random columns to average for each column of W.
*/
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp Sun Dec 7 14:26:16 2014
@@ -31,6 +31,11 @@
class CompleteIncrementalTermination
{
public:
+ /**
+ * Empty constructor
+ *
+ * @param t_policy object of wrapped class.
+ */
CompleteIncrementalTermination(TerminationPolicy t_policy = TerminationPolicy())
: t_policy(t_policy) {}
@@ -67,7 +72,7 @@
{
return iteration;
}
-
+
const size_t& MaxIterations()
{
return t_policy.MaxIterations();
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp Sun Dec 7 14:26:16 2014
@@ -29,6 +29,11 @@
class IncompleteIncrementalTermination
{
public:
+ /**
+ * Empty constructor
+ *
+ * @param t_policy object of wrapped class.
+ */
IncompleteIncrementalTermination(TerminationPolicy t_policy = TerminationPolicy())
: t_policy(t_policy) {}
@@ -44,7 +49,7 @@
bool IsConverged(arma::mat& W, arma::mat& H)
{
iteration++;
- if(iteration % incrementalIndex == 0)
+ if(iteration % incrementalIndex == 0)
return t_policy.IsConverged(W, H);
else return false;
}
@@ -61,7 +66,7 @@
{
return t_policy.MaxIterations();
}
-
+
private:
TerminationPolicy t_policy;
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_als.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_als.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_als.hpp Sun Dec 7 14:26:16 2014
@@ -2,13 +2,7 @@
* @file nmf_als.hpp
* @author Mohan Rajendran
*
- * Update rules for the Non-negative Matrix Factorization. This follows a method
- * titled 'Alternating Least Squares' described in the paper 'Positive Matrix
- * Factorization: A Non-negative Factor Model with Optimal Utilization of
- * Error Estimates of Data Values' by P. Paatero and U. Tapper. It uses least
- * squares projection formula to reduce the error value of
- * \f$ \sqrt{\sum_i \sum_j(V-WH)^2} \f$ by alternately calculating W and H
- * respectively while holding the other matrix constant.
+ * Update rules for the Non-negative Matrix Factorization.
*
* This file is part of MLPACK 1.0.10.
*
@@ -34,12 +28,17 @@
namespace amf {
/**
- * The alternating least square update rules of matrices W and H.
+ * This class implements a method titled 'Alternating Least Squares' described
+ * in the paper 'Positive Matrix Factorization: A Non-negative Factor Model with
+ * Optimal Utilization of Error Estimates of Data Values' by P Paatero and
+ * U Tapper. It uses least squares projection formula to reduce the error
+ * value of \f$ \sqrt{\sum_i \sum_j(V-WH)^2} \f$ by alternately calculating W
+ * and H respectively while holding the other matrix constant.
*/
class NMFALSUpdate
{
public:
- // Empty constructor required for the UpdateRule template.
+ //! Empty constructor required for the UpdateRule template.
NMFALSUpdate() { }
template<typename MatType>
@@ -108,7 +107,7 @@
}
}
}
-};
+}; // class NMFALSUpdate
}; // namespace amf
}; // namespace mlpack
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp Sun Dec 7 14:26:16 2014
@@ -2,12 +2,7 @@
* @file nmf_mult_dist.hpp
* @author Mohan Rajendran
*
- * Update rules for the Non-negative Matrix Factorization. This follows a method
- * described in the paper 'Algorithms for Non-negative Matrix Factorization'
- * by D. D. Lee and H. S. Seung. This is a multiplicative rule that ensures
- * that the Frobenius norm \f$ \sqrt{\sum_i \sum_j(V-WH)^2} \f$ is
- * non-increasing between subsequent iterations. Both of the update rules
- * for W and H are defined in this file.
+ * Update rules for the Non-negative Matrix Factorization.
*
* This file is part of MLPACK 1.0.10.
*
@@ -33,12 +28,17 @@
namespace amf {
/**
- * The multiplicative distance update rules for matrices W and H.
+ * The multiplicative distance update rules for matrices W and H. This follows
+ * a method described in the paper 'Algorithms for Non-negative Matrix Factorization'
+ * by D. D. Lee and H. S. Seung. This is a multiplicative rule that ensures
+ * that the Frobenius norm \f$ \sqrt{\sum_i \sum_j(V-WH)^2} \f$ is
+ * non-increasing between subsequent iterations. Both of the update rules
+ * for W and H are defined in this file.
*/
class NMFMultiplicativeDistanceUpdate
{
public:
- // Empty constructor required for the UpdateRule template.
+ // Empty constructor required for the UpdateRule template.
NMFMultiplicativeDistanceUpdate() { }
template<typename MatType>
Modified: mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp
==============================================================================
--- mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp (original)
+++ mlpack/tags/mlpack-1.0.11/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp Sun Dec 7 14:26:16 2014
@@ -2,17 +2,7 @@
* @file mult_div_update_rules.hpp
* @author Mohan Rajendran
*
- * Update rules for the Non-negative Matrix Factorization. This follows a method
- * described in the paper 'Algorithms for Non-negative Matrix Factorization'
- * by D. D. Lee and H. S. Seung. This is a multiplicative rule that ensures
- * that the Kullback–Leibler divergence
- * \f$ \sum_i \sum_j (V_{ij} log\frac{V_{ij}}{(WH)_{ij}}-V_{ij}+(WH)_{ij}) \f$is
- * non-increasing between subsequent iterations. Both of the update rules
- * for W and H are defined in this file.
- *
- * This set of update rules is not meant to work with sparse matrices. Using
- * sparse matrices often causes NaNs in the output, so other choices of update
- * rules are better in that situation.
+ * Update rules for the Non-negative Matrix Factorization.
*
* This file is part of MLPACK 1.0.10.
*
@@ -37,6 +27,18 @@
namespace mlpack {
namespace amf {
+/**
+ * This follows a method described in the paper 'Algorithms for Non-negative
+ * Matrix Factorization' by D. D. Lee and H. S. Seung. This is a multiplicative
+ * rule that ensures that the Kullback–Leibler divergence
+ * \f$ \sum_i \sum_j (V_{ij} log\frac{V_{ij}}{(WH)_{ij}}-V_{ij}+(WH)_{ij}) \f$
+ * is non-increasing between subsequent iterations. Both of the update rules
+ * for W and H are defined in this file.
+ *
+ * This set of update rules is not meant to work with sparse matrices. Using
+ * sparse matrices often causes NaNs in the output, so other choices of update
+ * rules are better in that situation.
+ */
class NMFMultiplicativeDivergenceUpdate
{
public:
More information about the mlpack-svn
mailing list