mlpack  2.2.5
SimpleResidueTermination Class Reference

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...

 

Detailed Description

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.

See also
AMF

Definition at line 31 of file simple_residue_termination.hpp.

Constructor & Destructor Documentation

◆ SimpleResidueTermination()

SimpleResidueTermination ( const double  minResidue = 1e-5,
const size_t  maxIterations = 10000 
)
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.

Parameters
minResidueMinimum residue for termination.
maxIterationsMaximum number of iterations.

Definition at line 42 of file simple_residue_termination.hpp.

Member Function Documentation

◆ Index()

const double& Index ( ) const
inline

Get current value of residue.

Definition at line 89 of file simple_residue_termination.hpp.

References SimpleResidueTermination::residue.

◆ Initialize()

void Initialize ( const MatType &  V)
inline

Initializes the termination policy before stating the factorization.

Parameters
VInput matrix being factorized.

Definition at line 52 of file simple_residue_termination.hpp.

References SimpleResidueTermination::iteration, SimpleResidueTermination::nm, SimpleResidueTermination::normOld, and SimpleResidueTermination::residue.

◆ IsConverged()

bool IsConverged ( arma::mat &  W,
arma::mat &  H 
)
inline

Check if termination criterion is met.

Parameters
WBasis matrix of output.
HEncoding matrix of output.

Definition at line 68 of file simple_residue_termination.hpp.

References Log::Info, SimpleResidueTermination::iteration, SimpleResidueTermination::maxIterations, SimpleResidueTermination::normOld, and SimpleResidueTermination::residue.

◆ Iteration()

const size_t& Iteration ( ) const
inline

Get current iteration count.

Definition at line 92 of file simple_residue_termination.hpp.

References SimpleResidueTermination::iteration.

◆ MaxIterations() [1/2]

const size_t& MaxIterations ( ) const
inline

Access max iteration count.

Definition at line 95 of file simple_residue_termination.hpp.

References SimpleResidueTermination::maxIterations.

◆ MaxIterations() [2/2]

size_t& MaxIterations ( )
inline

◆ MinResidue() [1/2]

const double& MinResidue ( ) const
inline

Access minimum residue value.

Definition at line 99 of file simple_residue_termination.hpp.

References SimpleResidueTermination::minResidue.

◆ MinResidue() [2/2]

double& MinResidue ( )
inline

Member Data Documentation

◆ iteration

◆ maxIterations

size_t maxIterations

◆ minResidue

double minResidue

residue threshold

Definition at line 104 of file simple_residue_termination.hpp.

Referenced by SimpleResidueTermination::MinResidue().

◆ nm

size_t nm

◆ normOld

double normOld

norm of previous iteration

Definition at line 113 of file simple_residue_termination.hpp.

Referenced by SimpleResidueTermination::Initialize(), and SimpleResidueTermination::IsConverged().

◆ residue


The documentation for this class was generated from the following file: