|
| 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. More...
|
|
|
double | Apply (const MatType &V, const size_t r, arma::mat &W, arma::mat &H) |
| Apply Alternating Matrix Factorization to the provided matrix. More...
|
|
const InitializationRuleType & | InitializeRule () const |
| Access the initialization rule. More...
|
|
InitializationRuleType & | InitializeRule () |
| Modify the initialization rule. More...
|
|
const TerminationPolicyType & | TerminationPolicy () const |
| Access the termination policy. More...
|
|
TerminationPolicyType & | TerminationPolicy () |
| Modify the termination policy. More...
|
|
const UpdateRuleType & | Update () const |
| Access the update rule. More...
|
|
UpdateRuleType & | Update () |
| Modify the update rule. More...
|
|
template<typename TerminationPolicyType = SimpleResidueTermination, typename InitializationRuleType = RandomAcolInitialization<>, typename UpdateRuleType = NMFMultiplicativeDistanceUpdate>
class mlpack::amf::AMF< TerminationPolicyType, InitializationRuleType, UpdateRuleType >
This class implements AMF (alternating matrix factorization) on the given matrix V.
Alternating matrix factorization decomposes V in the form where W is called the basis matrix and H is called the encoding matrix. V is taken to be of size n x m and the obtained W is n x r and H is r x m. The size r is called the rank of the factorization.
The implementation requires three template types; the first contains the policy used to determine when the algorithm has converged; the second contains the initialization rule for the W and H matrix; the last contains the update rule to be used during each iteration. This templatization allows the user to try various update rules, initialization rules, and termination policies (including ones not supplied with mlpack) for factorization. By default, the template parameters to AMF implement non-negative matrix factorization with the multiplicative distance update.
A simple example of how to run AMF (or NMF) is shown below.
extern arma::mat V;
size_t r = 10;
arma::mat W;
arma::mat H;
AMF<> amf;
amf.Apply(V, r, W, H);
- Template Parameters
-
TerminationPolicy | The policy to use for determining when the factorization has converged. |
InitializationRule | The initialization rule for initializing W and H matrix. |
UpdateRule | The update rule for calculating W and H matrix at each iteration. |
- See also
- NMFMultiplicativeDistanceUpdate, SimpleResidueTermination
Definition at line 78 of file amf.hpp.