12 #ifndef MLPACK_METHODS_AMF_COMPLETE_INCREMENTAL_TERMINATION_HPP 13 #define MLPACK_METHODS_AMF_COMPLETE_INCREMENTAL_TERMINATION_HPP 28 template<
class TerminationPolicy>
38 TerminationPolicy tPolicy = TerminationPolicy()) :
39 tPolicy(tPolicy), incrementalIndex(0), iteration(0)
47 template<
class MatType>
50 tPolicy.Initialize(V);
53 incrementalIndex = arma::accu(V != 0);
65 tPolicy.Initialize(V);
68 incrementalIndex = V.n_nonzero;
86 if (iteration % incrementalIndex == 0)
87 return tPolicy.IsConverged(W, H);
93 const double&
Index()
const {
return tPolicy.Index(); }
96 const size_t&
Iteration()
const {
return iteration; }
104 const TerminationPolicy&
TPolicy()
const {
return tPolicy; }
106 TerminationPolicy&
TPolicy() {
return tPolicy; }
110 TerminationPolicy tPolicy;
114 size_t incrementalIndex;
122 #endif // MLPACK_METHODS_AMF_COMPLETE_INCREMENTAL_TERMINATION_HPP bool IsConverged(arma::mat &W, arma::mat &H)
Check if termination criterion is met, if the current iteration means that each point has been visite...
Linear algebra utility functions, generally performed on matrices or vectors.
void Initialize(const arma::sp_mat &V)
Initializes the termination policy before stating the factorization.
const double & Index() const
Get current value of residue.
void Initialize(const MatType &V)
Initializes the termination policy before stating the factorization.
const size_t & Iteration() const
Get current iteration count.
This class acts as a wrapper for basic termination policies to be used by SVDCompleteIncrementalLearn...
CompleteIncrementalTermination(TerminationPolicy tPolicy=TerminationPolicy())
Empty constructor.
TerminationPolicy & TPolicy()
Modify the wrapped termination policy.
const size_t & MaxIterations() const
Access upper limit of iteration count.
const TerminationPolicy & TPolicy() const
Access the wrapped termination policy.
size_t & MaxIterations()
Modify maximum number of iterations.