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 98 of file simple_residue_termination.hpp.
References SimpleResidueTermination::residue.
|
inline |
Initializes the termination policy before stating the factorization.
V | Input matrix being factorized. |
Definition at line 60 of file simple_residue_termination.hpp.
References SimpleResidueTermination::iteration, SimpleResidueTermination::nm, SimpleResidueTermination::normOld, and SimpleResidueTermination::residue.
|
inline |
Check if termination criterion is met.
W | Basis matrix of output. |
H | Encoding matrix of output. |
Definition at line 76 of file simple_residue_termination.hpp.
References Log::Info, SimpleResidueTermination::iteration, SimpleResidueTermination::maxIterations, SimpleResidueTermination::minResidue, SimpleResidueTermination::normOld, and SimpleResidueTermination::residue.
|
inline |
Get current iteration count.
Definition at line 101 of file simple_residue_termination.hpp.
References SimpleResidueTermination::iteration.
|
inline |
Access max iteration count.
Definition at line 104 of file simple_residue_termination.hpp.
References SimpleResidueTermination::maxIterations.
|
inline |
Definition at line 105 of file simple_residue_termination.hpp.
References SimpleResidueTermination::maxIterations.
|
inline |
Access minimum residue value.
Definition at line 108 of file simple_residue_termination.hpp.
References SimpleResidueTermination::minResidue.
|
inline |
Definition at line 109 of file simple_residue_termination.hpp.
References SimpleResidueTermination::minResidue.
size_t iteration |
current iteration count
Definition at line 120 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::Initialize(), SimpleResidueTermination::IsConverged(), and SimpleResidueTermination::Iteration().
size_t maxIterations |
iteration threshold
Definition at line 115 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::IsConverged(), and SimpleResidueTermination::MaxIterations().
double minResidue |
residue threshold
Definition at line 113 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::IsConverged(), and SimpleResidueTermination::MinResidue().
size_t nm |
Definition at line 124 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::Initialize().
double normOld |
norm of previous iteration
Definition at line 122 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::Initialize(), and SimpleResidueTermination::IsConverged().
double residue |
current value of residue
Definition at line 118 of file simple_residue_termination.hpp.
Referenced by SimpleResidueTermination::Index(), SimpleResidueTermination::Initialize(), and SimpleResidueTermination::IsConverged().