mlpack
master
|
This class implements a simple residue-based termination policy. More...
Public Member Functions | |
SimpleResidueTermination (const double minResidue=1e-5, const size_t maxIterations=10000) | |
Construct the SimpleResidueTermination object with the given minimum residue (or the default) and the given maximum number of iterations (or the default). More... | |
const double & | Index () const |
Get current value of residue. More... | |
template<typename MatType > | |
void | Initialize (const MatType &V) |
Initializes the termination policy before stating the factorization. More... | |
bool | IsConverged (arma::mat &W, arma::mat &H) |
Check if termination criterion is met. More... | |
const size_t & | Iteration () const |
Get current iteration count. More... | |
const size_t & | MaxIterations () const |
Access max iteration count. More... | |
size_t & | MaxIterations () |
const double & | MinResidue () const |
Access minimum residue value. More... | |
double & | MinResidue () |
Public Attributes | |
size_t | iteration |
current iteration count More... | |
size_t | maxIterations |
iteration threshold More... | |
double | minResidue |
residue threshold More... | |
size_t | nm |
double | normOld |
norm of previous iteration More... | |
double | residue |
current value of residue More... | |
This class implements a simple residue-based termination policy.
The termination decision depends on two factors: the value of the residue (the difference between the norm of WH this iteration and the previous iteration), and the number of iterations. If the current value of residue drops below the threshold or the number of iterations goes above the iteration limit, IsConverged() will return true. This class is meant for use with the AMF (alternating matrix factorization) class.
Definition at line 31 of file simple_residue_termination.hpp.
|
inline |
Construct the SimpleResidueTermination object with the given minimum residue (or the default) and the given maximum number of iterations (or the default).
0 indicates no iteration limit.
minResidue | Minimum residue for termination. |
maxIterations | Maximum number of iterations. |
Definition at line 42 of file simple_residue_termination.hpp.
|
inline |
Get current value of residue.
Definition at line 89 of file simple_residue_termination.hpp.
References residue.
|
inline |
|
inline |
Check if termination criterion is met.
W | Basis matrix of output. |
H | Encoding matrix of output. |
Definition at line 68 of file simple_residue_termination.hpp.
References mlpack::Log::Info, iteration, maxIterations, normOld, and residue.
|
inline |
Get current iteration count.
Definition at line 92 of file simple_residue_termination.hpp.
References iteration.
|
inline |
Access max iteration count.
Definition at line 95 of file simple_residue_termination.hpp.
References maxIterations.
|
inline |
Definition at line 96 of file simple_residue_termination.hpp.
References maxIterations.
|
inline |
Access minimum residue value.
Definition at line 99 of file simple_residue_termination.hpp.
References minResidue.
|
inline |
Definition at line 100 of file simple_residue_termination.hpp.
References minResidue.
size_t mlpack::amf::SimpleResidueTermination::iteration |
current iteration count
Definition at line 111 of file simple_residue_termination.hpp.
Referenced by Initialize(), IsConverged(), and Iteration().
size_t mlpack::amf::SimpleResidueTermination::maxIterations |
iteration threshold
Definition at line 106 of file simple_residue_termination.hpp.
Referenced by IsConverged(), and MaxIterations().
double mlpack::amf::SimpleResidueTermination::minResidue |
residue threshold
Definition at line 104 of file simple_residue_termination.hpp.
Referenced by MinResidue().
size_t mlpack::amf::SimpleResidueTermination::nm |
Definition at line 115 of file simple_residue_termination.hpp.
Referenced by Initialize().
double mlpack::amf::SimpleResidueTermination::normOld |
norm of previous iteration
Definition at line 113 of file simple_residue_termination.hpp.
Referenced by Initialize(), and IsConverged().
double mlpack::amf::SimpleResidueTermination::residue |
current value of residue
Definition at line 109 of file simple_residue_termination.hpp.
Referenced by Index(), Initialize(), and IsConverged().