12 #ifndef _MLPACK_METHODS_AMF_INCOMPLETE_INCREMENTAL_TERMINATION_HPP 13 #define _MLPACK_METHODS_AMF_INCOMPLETE_INCREMENTAL_TERMINATION_HPP 27 template <
class TerminationPolicy>
37 TerminationPolicy tPolicy = TerminationPolicy()) :
38 tPolicy(tPolicy), incrementalIndex(0), iteration(0)
46 template<
class MatType>
49 tPolicy.Initialize(V);
52 incrementalIndex = V.n_rows;
69 if (iteration % incrementalIndex == 0)
70 return tPolicy.IsConverged(W, H);
76 const double&
Index()
const {
return tPolicy.Index(); }
79 const size_t&
Iteration()
const {
return iteration; }
87 const TerminationPolicy&
TPolicy()
const {
return tPolicy; }
89 TerminationPolicy&
TPolicy() {
return tPolicy; }
93 TerminationPolicy tPolicy;
96 size_t incrementalIndex;
size_t & MaxIterations()
Modify maximum number of iterations.
bool IsConverged(arma::mat &W, arma::mat &H)
Check if termination criterio is met.
TerminationPolicy & TPolicy()
Modify the wrapped termination policy.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
const TerminationPolicy & TPolicy() const
Access the wrapped termination policy.
const size_t & Iteration() const
Get current iteration count.
IncompleteIncrementalTermination(TerminationPolicy tPolicy=TerminationPolicy())
Empty constructor.
size_t MaxIterations() const
Access maximum number of iterations.
const double & Index() const
Get current value of residue.
This class acts as a wrapper for basic termination policies to be used by SVDIncompleteIncrementalLea...
void Initialize(const MatType &V)
Initializes the termination policy before stating the factorization.