ViennaCL - The Vienna Computing Library  1.7.1
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl::linalg::nmf_config Class Reference

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

#include <nmf_operations.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. More...
 
void tolerance (double e)
 Sets the relative tolerance for convergence, i.e. norm(V - W * H) / norm(V - W_init * H_init) More...
 
double stagnation_tolerance () const
 Relative tolerance for the stagnation check. More...
 
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) More...
 
vcl_size_t max_iterations () const
 Returns the maximum number of iterations for the NMF algorithm. More...
 
void max_iterations (vcl_size_t m)
 Sets the maximum number of iterations for the NMF algorithm. More...
 
vcl_size_t iters () const
 Returns the number of iterations of the last NMF run using this configuration object. More...
 
vcl_size_t check_after_steps () const
 Number of steps after which the convergence of NMF should be checked (again) More...
 
void check_after_steps (vcl_size_t c)
 Set the number of steps after which the convergence of NMF should be checked (again) More...
 
bool print_relative_error () const
 Returns the flag specifying whether the relative tolerance should be printed in each iteration. More...
 
void print_relative_error (bool b)
 Specify whether the relative error should be printed at each convergence check after 'num_check_iters' steps. More...
 

Public Attributes

vcl_size_t iters_
 

Friends

template<typename ScalarType >
void nmf (viennacl::matrix_base< ScalarType > const &V, viennacl::matrix_base< ScalarType > &W, viennacl::matrix_base< 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. More...
 

Detailed Description

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

Examples:
nmf.cpp.

Definition at line 39 of file nmf_operations.hpp.

Constructor & Destructor Documentation

viennacl::linalg::nmf_config::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

Definition at line 42 of file nmf_operations.hpp.

Member Function Documentation

vcl_size_t viennacl::linalg::nmf_config::check_after_steps ( ) const
inline

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

Definition at line 91 of file nmf_operations.hpp.

void viennacl::linalg::nmf_config::check_after_steps ( vcl_size_t  c)
inline

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

Definition at line 96 of file nmf_operations.hpp.

vcl_size_t viennacl::linalg::nmf_config::iters ( ) const
inline

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

Definition at line 85 of file nmf_operations.hpp.

vcl_size_t viennacl::linalg::nmf_config::max_iterations ( ) const
inline

Returns the maximum number of iterations for the NMF algorithm.

Examples:
nmf.cpp.

Definition at line 74 of file nmf_operations.hpp.

void viennacl::linalg::nmf_config::max_iterations ( vcl_size_t  m)
inline

Sets the maximum number of iterations for the NMF algorithm.

Definition at line 79 of file nmf_operations.hpp.

bool viennacl::linalg::nmf_config::print_relative_error ( ) const
inline

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

Examples:
nmf.cpp.

Definition at line 103 of file nmf_operations.hpp.

void viennacl::linalg::nmf_config::print_relative_error ( bool  b)
inline

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

Definition at line 108 of file nmf_operations.hpp.

double viennacl::linalg::nmf_config::stagnation_tolerance ( ) const
inline

Relative tolerance for the stagnation check.

Definition at line 62 of file nmf_operations.hpp.

void viennacl::linalg::nmf_config::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)

Definition at line 68 of file nmf_operations.hpp.

double viennacl::linalg::nmf_config::tolerance ( ) const
inline

Returns the relative tolerance for convergence.

Definition at line 50 of file nmf_operations.hpp.

void viennacl::linalg::nmf_config::tolerance ( double  e)
inline

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

Definition at line 56 of file nmf_operations.hpp.

Friends And Related Function Documentation

template<typename ScalarType >
void nmf ( viennacl::matrix_base< ScalarType > const &  V,
viennacl::matrix_base< ScalarType > &  W,
viennacl::matrix_base< 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

Definition at line 59 of file nmf_operations.hpp.

Member Data Documentation

vcl_size_t viennacl::linalg::nmf_config::iters_
mutable

Definition at line 125 of file nmf_operations.hpp.


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