ViennaCL - The Vienna Computing Library  1.5.1
Public Member Functions | Friends
nmf_config Class Reference

Configuration class for the nonnegative-matrix-factorization algorithm. Specify tolerances, maximum iteration counts, etc., here. More...

#include <nmf.hpp>

Public Member Functions

 nmf_config (double val_epsilon=1e-4, double val_epsilon_stagnation=1e-5, vcl_size_t num_max_iters=10000, vcl_size_t num_check_iters=100)
double tolerance () const
 Returns the relative tolerance for convergence.
void tolerance (double e)
 Sets the relative tolerance for convergence, i.e. norm(V - W * H) / norm(V - W_init * H_init)
double stagnation_tolerance () const
 Relative tolerance for the stagnation check.
void stagnation_tolerance (double e)
 Sets the tolerance for the stagnation check (i.e. the minimum required relative change of the residual between two iterations)
vcl_size_t max_iterations () const
 Returns the maximum number of iterations for the NMF algorithm.
void max_iterations (vcl_size_t m)
 Sets the maximum number of iterations for the NMF algorithm.
vcl_size_t iters () const
 Returns the number of iterations of the last NMF run using this configuration object.
vcl_size_t check_after_steps () const
 Number of steps after which the convergence of NMF should be checked (again)
void check_after_steps (vcl_size_t c)
 Set the number of steps after which the convergence of NMF should be checked (again)
bool print_relative_error () const
 Returns the flag specifying whether the relative tolerance should be printed in each iteration.
void print_relative_error (bool b)
 Specify whether the relative error should be printed at each convergence check after 'num_check_iters' steps.

Friends

template<typename ScalarType >
void nmf (viennacl::matrix< ScalarType > const &V, viennacl::matrix< ScalarType > &W, viennacl::matrix< ScalarType > &H, nmf_config const &conf)
 The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung. Factorizes a matrix V with nonnegative entries into matrices W and H such that ||V - W*H|| is minimized.

Detailed Description

Configuration class for the nonnegative-matrix-factorization algorithm. Specify tolerances, maximum iteration counts, etc., here.


Constructor & Destructor Documentation

nmf_config ( double  val_epsilon = 1e-4,
double  val_epsilon_stagnation = 1e-5,
vcl_size_t  num_max_iters = 10000,
vcl_size_t  num_check_iters = 100 
) [inline]

Member Function Documentation

vcl_size_t check_after_steps ( ) const [inline]

Number of steps after which the convergence of NMF should be checked (again)

void check_after_steps ( vcl_size_t  c) [inline]

Set the number of steps after which the convergence of NMF should be checked (again)

vcl_size_t iters ( ) const [inline]

Returns the number of iterations of the last NMF run using this configuration object.

vcl_size_t max_iterations ( ) const [inline]

Returns the maximum number of iterations for the NMF algorithm.

void max_iterations ( vcl_size_t  m) [inline]

Sets the maximum number of iterations for the NMF algorithm.

bool print_relative_error ( ) const [inline]

Returns the flag specifying whether the relative tolerance should be printed in each iteration.

void print_relative_error ( bool  b) [inline]

Specify whether the relative error should be printed at each convergence check after 'num_check_iters' steps.

double stagnation_tolerance ( ) const [inline]

Relative tolerance for the stagnation check.

void stagnation_tolerance ( double  e) [inline]

Sets the tolerance for the stagnation check (i.e. the minimum required relative change of the residual between two iterations)

double tolerance ( ) const [inline]

Returns the relative tolerance for convergence.

void tolerance ( double  e) [inline]

Sets the relative tolerance for convergence, i.e. norm(V - W * H) / norm(V - W_init * H_init)


Friends And Related Function Documentation

void nmf ( viennacl::matrix< ScalarType > const &  V,
viennacl::matrix< ScalarType > &  W,
viennacl::matrix< ScalarType > &  H,
nmf_config const &  conf 
) [friend]

The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung. Factorizes a matrix V with nonnegative entries into matrices W and H such that ||V - W*H|| is minimized.

Parameters:
VInput matrix
WFirst factor
HSecond factor
confA configuration object holding tolerances and the like

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