amf.hpp
Go to the documentation of this file.
1 
18 #ifndef MLPACK_METHODS_AMF_AMF_HPP
19 #define MLPACK_METHODS_AMF_AMF_HPP
20 
21 #include <mlpack/prereqs.hpp>
22 
28 
31 
34 
35 namespace mlpack {
36 namespace amf {
37 
75 template<typename TerminationPolicyType = SimpleResidueTermination,
76  typename InitializationRuleType = RandomAcolInitialization<>,
77  typename UpdateRuleType = NMFMultiplicativeDistanceUpdate>
78 class AMF
79 {
80  public:
97  AMF(const TerminationPolicyType& terminationPolicy = TerminationPolicyType(),
98  const InitializationRuleType& initializeRule = InitializationRuleType(),
99  const UpdateRuleType& update = UpdateRuleType());
100 
109  template<typename MatType>
110  double Apply(const MatType& V,
111  const size_t r,
112  arma::mat& W,
113  arma::mat& H);
114 
116  const TerminationPolicyType& TerminationPolicy() const
117  { return terminationPolicy; }
119  TerminationPolicyType& TerminationPolicy() { return terminationPolicy; }
120 
122  const InitializationRuleType& InitializeRule() const
123  { return initializationRule; }
125  InitializationRuleType& InitializeRule() { return initializationRule; }
126 
128  const UpdateRuleType& Update() const { return update; }
130  UpdateRuleType& Update() { return update; }
131 
132  private:
134  TerminationPolicyType terminationPolicy;
136  InitializationRuleType initializationRule;
138  UpdateRuleType update;
139 }; // class AMF
140 
144 
146 
154 template<typename MatType = arma::mat>
156  amf::SimpleResidueTermination,
157  amf::RandomAcolInitialization<>,
159 
168 template<class MatType = arma::mat>
170  amf::SimpleResidueTermination,
171  amf::RandomAcolInitialization<>,
181 template<class MatType = arma::mat>
183  amf::SimpleResidueTermination,
184  amf::RandomAcolInitialization<>,
186 } // namespace amf
187 } // namespace mlpack
188 
189 // Include implementation.
190 #include "amf_impl.hpp"
191 
192 #endif // MLPACK_METHODS_AMF_AMF_HPP
193 
UpdateRuleType & Update()
Modify the update rule.
Definition: amf.hpp:130
This class computes SVD using complete incremental batch learning, as described in the following pape...
This class implements AMF (alternating matrix factorization) on the given matrix V.
Definition: amf.hpp:78
This class computes SVD using incomplete incremental batch learning, as described in the following pa...
strip_type.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
amf::AMF< amf::SimpleResidueTermination, amf::RandomAcolInitialization<>, amf::NMFALSUpdate > NMFALSFactorizer
Definition: amf.hpp:143
This class implements a simple residue-based termination policy.
const UpdateRuleType & Update() const
Access the update rule.
Definition: amf.hpp:128
This class implements SVD batch learning with momentum.
This class implements a method titled &#39;Alternating Least Squares&#39; described in the following paper: ...
Definition: nmf_als.hpp:41
double Apply(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)
Apply Alternating Matrix Factorization to the provided matrix.
AMF(const TerminationPolicyType &terminationPolicy=TerminationPolicyType(), const InitializationRuleType &initializeRule=InitializationRuleType(), const UpdateRuleType &update=UpdateRuleType())
Create the AMF object and (optionally) set the parameters which AMF will run with.
const TerminationPolicyType & TerminationPolicy() const
Access the termination policy.
Definition: amf.hpp:116
InitializationRuleType & InitializeRule()
Modify the initialization rule.
Definition: amf.hpp:125
This class initializes the W matrix of the AMF algorithm by averaging p randomly chosen columns of V...
const InitializationRuleType & InitializeRule() const
Access the initialization rule.
Definition: amf.hpp:122
TerminationPolicyType & TerminationPolicy()
Modify the termination policy.
Definition: amf.hpp:119
The multiplicative distance update rules for matrices W and H.