DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
Public Member Functions | Private Member Functions | Private Attributes | List of all members
spams::Trainer< T > Class Template Reference

#include <dicts.h>

Detailed Description

template<typename T>
class spams::Trainer< T >

Definition at line 128 of file dicts.h.

Public Member Functions

void getA (Matrix< T > &A) const
 
void getB (Matrix< T > &B) const
 
void getD (Matrix< T > &D) const
 
int getIter () const
 
void train (const Data< T > &X, const ParamDictLearn< T > &param)
 
void train (const Data< T > &X, const vector_groups &groups, const int J, const constraint_type mode, const bool whiten=false, const T *param_C=NULL, const int p=1, const bool pattern=false)
 
 Trainer ()
 
 Trainer (const int k, const int batchsize=256, const int NUM_THREADS=-1)
 
 Trainer (const Matrix< T > &D, const int batchsize=256, const int NUM_THREADS=-1)
 
 Trainer (const Matrix< T > &A, const Matrix< T > &B, const Matrix< T > &D, const int itercount, const int batchsize, const int NUM_THREADS)
 
void trainOffline (const Data< T > &X, const ParamDictLearn< T > &param)
 

Private Member Functions

void cleanDict (const Data< T > &X, Matrix< T > &G, const bool posD=false, const constraint_type_D modeD=L2, const T gamma1=0, const T gamma2=0, const T maxCorrel=0.999999)
 
void cleanDict (Matrix< T > &G)
 
Trainer< T > & operator= (const Trainer< T > &trainer)
 
 Trainer (const Trainer< T > &trainer)
 

Private Attributes

Matrix< T > _A
 
Matrix< T > _B
 
int _batchsize
 
Matrix< T > _D
 
bool _initialDict
 
int _itercount
 
int _k
 
int _NUM_THREADS
 

Constructor & Destructor Documentation

template<typename T >
spams::Trainer< T >::Trainer ( )

Empty constructor.

Definition at line 187 of file dicts.h.

References spams::Trainer< T >::_batchsize, spams::Trainer< T >::_NUM_THREADS, MAX_THREADS, and MIN.

template<typename T >
spams::Trainer< T >::Trainer ( const int  k,
const int  batchsize = 256,
const int  NUM_THREADS = -1 
)

Constructor with data.

Definition at line 197 of file dicts.h.

References spams::Trainer< T >::_NUM_THREADS, MAX_THREADS, and MIN.

template<typename T >
spams::Trainer< T >::Trainer ( const Matrix< T > &  D,
const int  batchsize = 256,
const int  NUM_THREADS = -1 
)

Constructor with initial dictionary.

Definition at line 210 of file dicts.h.

References spams::Trainer< T >::_A, spams::Trainer< T >::_B, spams::Trainer< T >::_D, spams::Trainer< T >::_NUM_THREADS, spams::Matrix< T >::m(), MAX_THREADS, MIN, and spams::Matrix< T >::n().

+ Here is the call graph for this function:

template<typename T >
spams::Trainer< T >::Trainer ( const Matrix< T > &  A,
const Matrix< T > &  B,
const Matrix< T > &  D,
const int  itercount,
const int  batchsize,
const int  NUM_THREADS 
)

Constructor with existing structure.

Definition at line 226 of file dicts.h.

References spams::Trainer< T >::_A, spams::Trainer< T >::_B, spams::Trainer< T >::_D, spams::Trainer< T >::_NUM_THREADS, MAX_THREADS, and MIN.

template<typename T>
spams::Trainer< T >::Trainer ( const Trainer< T > &  trainer)
explicitprivate

Forbid lazy copies.

Member Function Documentation

template<typename T >
void spams::Trainer< T >::cleanDict ( const Data< T > &  X,
Matrix< T > &  G,
const bool  posD = false,
const constraint_type_D  modeD = L2,
const T  gamma1 = 0,
const T  gamma2 = 0,
const T  maxCorrel = 0.999999 
)
private

clean the dictionary

remove element j and replace it by a random element of X

Definition at line 243 of file dicts.h.

References spams::Trainer< T >::_D, spams::abs(), spams::Vector< T >::copy(), spams::Data< T >::getData(), spams::L1L2, spams::L2, spams::Data< T >::n(), spams::Vector< T >::normalize(), spams::Matrix< T >::rawX(), spams::Matrix< T >::refCol(), spams::Vector< T >::sparseProject(), and spams::Vector< T >::thrsPos().

Referenced by spams::Trainer< T >::train(), and spams::Trainer< T >::trainOffline().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::Trainer< T >::cleanDict ( Matrix< T > &  G)
private

clean the dictionary

Definition at line 284 of file dicts.h.

References spams::Trainer< T >::_D, and spams::Matrix< T >::rawX().

+ Here is the call graph for this function:

template<typename T>
void spams::Trainer< T >::getA ( Matrix< T > &  A) const
inline

Accessors.

Definition at line 154 of file dicts.h.

References spams::Matrix< T >::copy().

+ Here is the call graph for this function:

template<typename T>
void spams::Trainer< T >::getB ( Matrix< T > &  B) const
inline

Definition at line 155 of file dicts.h.

References spams::Matrix< T >::copy().

+ Here is the call graph for this function:

template<typename T>
void spams::Trainer< T >::getD ( Matrix< T > &  D) const
inline

Definition at line 156 of file dicts.h.

References spams::Matrix< T >::copy().

+ Here is the call graph for this function:

template<typename T>
int spams::Trainer< T >::getIter ( ) const
inline
template<typename T>
Trainer<T>& spams::Trainer< T >::operator= ( const Trainer< T > &  trainer)
private

Forbid lazy copies.

template<typename T >
void spams::Trainer< T >::train ( const Data< T > &  X,
const ParamDictLearn< T > &  param 
)

train or retrain using the matrix X

Dictionary Update Check the epoch parity

Definition at line 295 of file dicts.h.

References spams::Trainer< T >::_A, spams::Trainer< T >::_B, spams::Trainer< T >::_batchsize, spams::Trainer< T >::_D, spams::Trainer< T >::_initialDict, spams::Trainer< T >::_itercount, spams::Trainer< T >::_k, spams::Trainer< T >::_NUM_THREADS, spams::Matrix< T >::add(), spams::Vector< T >::add(), spams::Matrix< T >::addDiag(), spams::AUTO, spams::ParamDictLearn< T >::batch, spams::ParamDictLearn< T >::clean, spams::Trainer< T >::cleanDict(), spams::Matrix< T >::conjugateGradient(), spams::Matrix< T >::copy(), spams::Vector< T >::copy(), spams::coreLARS2(), spams::coreORMPB(), spams::ParamDictLearn< T >::gamma1, spams::ParamDictLearn< T >::gamma2, spams::Data< T >::getData(), spams::Timer::getElapsed(), spams::init_omp(), spams::ParamDictLearn< T >::iter, spams::ParamDictLearn< T >::iter_updateD, spams::L1L2, spams::L2, spams::L2ERROR2, spams::ParamDictLearn< T >::lambda, spams::ParamDictLearn< T >::lambda2, spams::ParamDictLearn< T >::log, spams::ParamDictLearn< T >::logName, spams::Data< T >::m(), MAX, MIN, spams::ParamDictLearn< T >::mode, spams::ParamDictLearn< T >::modeD, spams::ParamDictLearn< T >::modeParam, spams::Data< T >::n(), spams::Vector< T >::normalize2(), spams::PARAM1, spams::PARAM2, spams::ParamDictLearn< T >::pattern, spams::PENALTY, spams::ParamDictLearn< T >::posAlpha, spams::ParamDictLearn< T >::posD, spams::Timer::printElapsed(), spams::Vector< T >::randperm(), spams::Matrix< T >::rank1Update(), spams::Vector< T >::rawX(), spams::SpVector< T >::refIndices(), spams::SpVector< T >::refVal(), spams::Matrix< T >::resize(), spams::Vector< T >::resize(), spams::SpVector< T >::resize(), spams::ParamDictLearn< T >::rho, spams::Matrix< T >::scal(), spams::Vector< T >::scal(), spams::Vector< T >::set(), spams::SpVector< T >::setL(), spams::Matrix< T >::setZeros(), spams::Vector< T >::setZeros(), spams::sort(), spams::Vector< T >::sparseProject(), spams::SPARSITY, spams::Timer::start(), spams::ParamDictLearn< T >::stochastic, spams::Timer::stop(), spams::ParamDictLearn< T >::t0, spams::Vector< T >::thrsPos(), spams::Data< T >::V(), spams::ParamDictLearn< T >::verbose, spams::ParamDictLearn< T >::whiten, and spams::writeLog().

+ Here is the call graph for this function:

template<typename T>
void spams::Trainer< T >::train ( const Data< T > &  X,
const vector_groups groups,
const int  J,
const constraint_type  mode,
const bool  whiten = false,
const T *  param_C = NULL,
const int  p = 1,
const bool  pattern = false 
)

train or retrain using the groups XT

template<typename T >
void spams::Trainer< T >::trainOffline ( const Data< T > &  X,
const ParamDictLearn< T > &  param 
)

Definition at line 736 of file dicts.h.

References spams::Trainer< T >::_batchsize, spams::Trainer< T >::_D, spams::Trainer< T >::_initialDict, spams::Trainer< T >::_k, spams::Trainer< T >::_NUM_THREADS, spams::Matrix< T >::add(), spams::Vector< T >::add(), spams::ParamDictLearn< T >::clean, spams::Trainer< T >::cleanDict(), spams::Vector< T >::copy(), spams::coreIST(), spams::coreISTconstrained(), spams::ParamDictLearn< T >::gamma1, spams::ParamDictLearn< T >::gamma2, spams::Data< T >::getData(), spams::Timer::getElapsed(), spams::init_omp(), spams::ParamDictLearn< T >::iter, spams::ParamDictLearn< T >::iter_updateD, spams::L1L2, spams::L2, spams::ParamDictLearn< T >::lambda, spams::Data< T >::m(), MAX, MIN, spams::ParamDictLearn< T >::mode, spams::ParamDictLearn< T >::modeD, spams::ParamDictLearn< T >::modeParam, spams::Matrix< T >::mult(), spams::Data< T >::n(), spams::Vector< T >::n(), spams::Matrix< T >::norm_l1_rows(), spams::Vector< T >::normalize2(), spams::PARAM1, spams::PARAM2, spams::ParamDictLearn< T >::pattern, spams::PENALTY, spams::ParamDictLearn< T >::posD, spams::Timer::printElapsed(), spams::Vector< T >::randperm(), spams::Matrix< T >::rank1Update(), spams::Matrix< T >::refCol(), spams::Matrix< T >::resize(), spams::Vector< T >::resize(), spams::SpVector< T >::resize(), spams::ParamDictLearn< T >::rho, spams::Matrix< T >::scal(), spams::Vector< T >::scal(), spams::Matrix< T >::setZeros(), spams::Vector< T >::setZeros(), spams::Vector< T >::sparseProject(), spams::Timer::start(), spams::Vector< T >::sub(), spams::Vector< T >::thrsPos(), spams::Vector< T >::toSparse(), spams::Data< T >::V(), spams::ParamDictLearn< T >::verbose, and spams::ParamDictLearn< T >::whiten.

+ Here is the call graph for this function:

Member Data Documentation

template<typename T>
Matrix<T> spams::Trainer< T >::_A
private

Definition at line 176 of file dicts.h.

Referenced by spams::Trainer< T >::train(), and spams::Trainer< T >::Trainer().

template<typename T>
Matrix<T> spams::Trainer< T >::_B
private

Definition at line 177 of file dicts.h.

Referenced by spams::Trainer< T >::train(), and spams::Trainer< T >::Trainer().

template<typename T>
int spams::Trainer< T >::_batchsize
private
template<typename T>
Matrix<T> spams::Trainer< T >::_D
private
template<typename T>
bool spams::Trainer< T >::_initialDict
private

Definition at line 180 of file dicts.h.

Referenced by spams::Trainer< T >::train(), and spams::Trainer< T >::trainOffline().

template<typename T>
int spams::Trainer< T >::_itercount
private

Definition at line 181 of file dicts.h.

Referenced by spams::Trainer< T >::train().

template<typename T>
int spams::Trainer< T >::_k
private

Definition at line 179 of file dicts.h.

Referenced by spams::Trainer< T >::train(), and spams::Trainer< T >::trainOffline().

template<typename T>
int spams::Trainer< T >::_NUM_THREADS
private

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