iRoCS Toolbox  1.1.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
svt::SVMBase< KF > Class Template Reference

The SVMBase class is the the base class for all SVM's. More...

#include <SVMBase.hh>

Inheritance diagram for svt::SVMBase< KF >:
Collaboration diagram for svt::SVMBase< KF >:

Data Structures

struct  Traits
 

Public Types

typedef KF KF_type
 

Public Member Functions

 SVMBase ()
 Default Constructor. More...
 
 SVMBase (const KF &kernel)
 Constructor with Kernel function. More...
 
 ~SVMBase ()
 Destructor. More...
 
float cacheSizeMB () const
 
template<typename FV >
double classify (const FV &testObject, const Model< FV > &model) const
 standard classification without caching the kernel evaluations. More...
 
void clearKernelCache () const
 call the clearCache() method of selected Kernel More...
 
KF & kernel ()
 access the kernel function More...
 
const KF & kernel () const
 
template<typename STDATA >
void loadParameters (STDATA &stData)
 Load parameters from structured data object. More...
 
template<typename STDATA >
void saveParameters (STDATA &stData) const
 save parameters to structured data object More...
 
void setCacheSizeMB (float s)
 set cache memory size in MB (default: 40) More...
 
void setProgressReporter (ProgressReporter *pr)
 set a progress reporter object. More...
 
void setShrinkingFlag (bool f)
 whether to use the shrinking heuristics (default: true) More...
 
void setTerminationEpsilon (double e)
 set tolerance of termination criterion (default: 0.001) More...
 
bool shrinkingFlag () const
 
double terminationEpsilon () const
 
template<typename ForwardIter , typename Accessor >
void updateKernelCache (const ForwardIter &fvBegin, const ForwardIter &fvEnd, Accessor accessor) const
 call the updateCache() method of selected Kernel More...
 

Static Public Member Functions

static void getParamInfos (std::vector< ParamInfo > &p)
 get information about the parameters, that are used in loadParameters() and saveParameters(). More...
 

Protected Attributes

float _cacheSizeMB
 
ProgressReporter_pr
 
bool _shrinkingFlag
 
double _terminationEpsilon
 
KF p_kernel
 

Detailed Description

template<typename KF>
class svt::SVMBase< KF >

The SVMBase class is the the base class for all SVM's.

it contains the parameters, that are needed for all training procedures (similar to svm_param in original libsvm)

Definition at line 101 of file SVMBase.hh.

Member Typedef Documentation

◆ KF_type

template<typename KF >
typedef KF svt::SVMBase< KF >::KF_type

Definition at line 108 of file SVMBase.hh.

Constructor & Destructor Documentation

◆ SVMBase() [1/2]

template<typename KF >
svt::SVMBase< KF >::SVMBase ( )
inline

Default Constructor.

Definition at line 119 of file SVMBase.hh.

◆ SVMBase() [2/2]

template<typename KF >
svt::SVMBase< KF >::SVMBase ( const KF &  kernel)
inline

Constructor with Kernel function.

The given kernel will be copied to a private variable. You may access it later with kernel()

Parameters
kernelthe kernel function object

Definition at line 137 of file SVMBase.hh.

◆ ~SVMBase()

template<typename KF >
svt::SVMBase< KF >::~SVMBase ( )
inline

Destructor.

Definition at line 151 of file SVMBase.hh.

Member Function Documentation

◆ kernel() [1/2]

template<typename KF >
KF& svt::SVMBase< KF >::kernel ( )
inline

access the kernel function

Returns
reference to kernel function

Definition at line 164 of file SVMBase.hh.

◆ kernel() [2/2]

template<typename KF >
const KF& svt::SVMBase< KF >::kernel ( ) const
inline

Definition at line 170 of file SVMBase.hh.

◆ updateKernelCache()

template<typename KF >
template<typename ForwardIter , typename Accessor >
void svt::SVMBase< KF >::updateKernelCache ( const ForwardIter &  fvBegin,
const ForwardIter &  fvEnd,
Accessor  accessor 
) const
inline

call the updateCache() method of selected Kernel

Parameters

Definition at line 187 of file SVMBase.hh.

◆ clearKernelCache()

template<typename KF >
void svt::SVMBase< KF >::clearKernelCache ( ) const
inline

call the clearCache() method of selected Kernel

Parameters

Definition at line 206 of file SVMBase.hh.

◆ classify()

template<typename KF >
template<typename FV >
double svt::SVMBase< KF >::classify ( const FV &  testObject,
const Model< FV > &  model 
) const

standard classification without caching the kernel evaluations.

Parameters
testObjectfeature vector of the test object
modelmodel containing Support Vectors, alphas and rho.
Returns
decision value

Referenced by svt::SVMBase< KF >::clearKernelCache().

◆ setTerminationEpsilon()

template<typename KF >
void svt::SVMBase< KF >::setTerminationEpsilon ( double  e)
inline

set tolerance of termination criterion (default: 0.001)

Parameters
enew value for epsilon

Definition at line 236 of file SVMBase.hh.

◆ terminationEpsilon()

template<typename KF >
double svt::SVMBase< KF >::terminationEpsilon ( ) const
inline

Definition at line 241 of file SVMBase.hh.

Referenced by svt::SVMBase< KF >::saveParameters().

◆ setCacheSizeMB()

template<typename KF >
void svt::SVMBase< KF >::setCacheSizeMB ( float  s)
inline

set cache memory size in MB (default: 40)

Parameters
scache size in MBytes

Definition at line 255 of file SVMBase.hh.

◆ cacheSizeMB()

template<typename KF >
float svt::SVMBase< KF >::cacheSizeMB ( ) const
inline

Definition at line 260 of file SVMBase.hh.

Referenced by svt::SVMBase< KF >::saveParameters().

◆ setShrinkingFlag()

template<typename KF >
void svt::SVMBase< KF >::setShrinkingFlag ( bool  f)
inline

whether to use the shrinking heuristics (default: true)

Parameters
ftrue = use shrinking heuristics

Definition at line 274 of file SVMBase.hh.

◆ shrinkingFlag()

template<typename KF >
bool svt::SVMBase< KF >::shrinkingFlag ( ) const
inline

Definition at line 279 of file SVMBase.hh.

Referenced by svt::SVMBase< KF >::saveParameters().

◆ loadParameters()

template<typename KF >
template<typename STDATA >
void svt::SVMBase< KF >::loadParameters ( STDATA &  stData)
inline

Load parameters from structured data object.

Definition at line 290 of file SVMBase.hh.

Referenced by svt::TwoClassSVMnu< KF >::loadParameters(), and svt::TwoClassSVMc< KF >::loadParameters().

◆ saveParameters()

template<typename KF >
template<typename STDATA >
void svt::SVMBase< KF >::saveParameters ( STDATA &  stData) const
inline

save parameters to structured data object

Definition at line 306 of file SVMBase.hh.

Referenced by svt::TwoClassSVMnu< KF >::saveParameters(), and svt::TwoClassSVMc< KF >::saveParameters().

◆ getParamInfos()

template<typename KF >
static void svt::SVMBase< KF >::getParamInfos ( std::vector< ParamInfo > &  p)
inlinestatic

get information about the parameters, that are used in loadParameters() and saveParameters().

The Infos are appended to the passed array

Parameters
parray of ParamInfos. The Infos will be appended to this array

Definition at line 326 of file SVMBase.hh.

Referenced by svt::TwoClassSVMnu< KF >::getParamInfos(), and svt::TwoClassSVMc< KF >::getParamInfos().

◆ setProgressReporter()

template<typename KF >
void svt::SVMBase< KF >::setProgressReporter ( ProgressReporter pr)
inline

set a progress reporter object.

Every time any progress is made in the training or classification, the reportProgress() method of this object is callled.

Parameters
prpointer to an object with a child class of ProgressReporter or 0, if you don't want any more progress reporting. You are responsible, that your ProgressReporter object is not deleted during operation of MultiClassSVMOneVsOne

Definition at line 358 of file SVMBase.hh.

Field Documentation

◆ p_kernel

template<typename KF >
KF svt::SVMBase< KF >::p_kernel
protected

◆ _terminationEpsilon

template<typename KF >
double svt::SVMBase< KF >::_terminationEpsilon
protected

◆ _cacheSizeMB

template<typename KF >
float svt::SVMBase< KF >::_cacheSizeMB
protected

◆ _shrinkingFlag

template<typename KF >
bool svt::SVMBase< KF >::_shrinkingFlag
protected

◆ _pr

template<typename KF >
ProgressReporter* svt::SVMBase< KF >::_pr
protected

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