iRoCS Toolbox
1.1.0
|
The MultiClassSVMOneVsOne class provides a one vs. More...
#include <MultiClassSVMOneVsOne.hh>
Data Structures | |
class | DummyResultMatrix |
struct | Traits |
Public Types | |
typedef TriangularMatrix< double > | DetailedResultType |
Public Member Functions | |
MultiClassSVMOneVsOne (const SVM &svm) | |
Create a multi class SVM basing on the given svm object. More... | |
MultiClassSVMOneVsOne () | |
Create a multi class SVM. More... | |
template<typename FV , typename ResultMatrix > | |
double | classify (const FV &testObject, const typename Traits< FV >::ModelType &model, ResultMatrix &resultMatrix) const |
classify the given testObject using the models in Model matrix. More... | |
template<typename FV > | |
double | classify (const FV &testObject, const typename Traits< FV >::ModelType &model) const |
classify the given testObject using the model More... | |
void | clearKernelCache () const |
call the clearKernelCache() method of selected two-class svm More... | |
template<typename STDATA > | |
void | loadParameters (STDATA &stData) |
template<typename FV , typename ResultMatrix > | |
unsigned int | predictClassIndex (const FV &testObject, const typename Traits< FV >::ModelType &model, ResultMatrix &resultMatrix) const |
classify the given testObject using the model More... | |
template<typename FV > | |
unsigned int | predictClassIndex (const FV &testObject, const typename Traits< FV >::ModelType &model) const |
classify the given testObject using the model More... | |
template<typename FV > | |
void | retrainWithLeftOutVectors (const GroupedTrainingData< FV > &trainData, const typename Traits< FV >::ModelType &fullModel, const std::vector< char > &leaveOutFlagsByUID, typename Traits< FV >::ModelType &resultingModel) const |
calls the retrainWithLeftOutVectors() for each two-class model, only if the model is affected by the left out vectors More... | |
template<typename ModelType , typename STDATA > | |
void | saveClassificationDetails (const ModelType &, const DetailedResultType &, STDATA &) const |
save classification details. More... | |
template<typename STDATA > | |
void | saveParameters (STDATA &stData) const |
void | setProgressReporter (ProgressReporter *pr) |
set a progress reporter object. More... | |
template<typename FV > | |
void | train (const GroupedTrainingData< FV > &trainData, typename Traits< FV >::ModelType &model) const |
train SVM with given Feature Vectors. More... | |
template<typename FV > | |
void | train (const SVM_Problem< FV > &problem, typename Traits< FV >::ModelType &model) const |
train SVM with given Feature Vectors. More... | |
template<typename ForwardIter > | |
void | train (ForwardIter FV_begin, const ForwardIter &FV_end, typename Traits< typename std::iterator_traits< ForwardIter >::value_type >::ModelType &model) const |
train the Multi Class SVM with the given feature vectors. More... | |
template<typename ForwardIter , typename Accessor > | |
void | train (ForwardIter FV_begin, const ForwardIter &FV_end, typename Traits< typename Accessor::template Traits< ForwardIter >::value_type >::ModelType &model, Accessor accessor) const |
same as train(), but you can specify an Accessor for accessing the elements of your container. More... | |
const SVM & | twoClassSVM () const |
SVM & | twoClassSVM () |
template<typename ForwardIter , typename Accessor > | |
void | updateKernelCache (const ForwardIter &fvBegin, const ForwardIter &fvEnd, Accessor accessor) const |
call the updateKernelCache() method of selected two-class svm More... | |
Static Public Member Functions | |
static const char * | description () |
static void | getParamInfos (std::vector< ParamInfo > &) |
get information about the parameters, that are used in loadParameters() and saveParameters(). More... | |
static const char * | name () |
The MultiClassSVMOneVsOne class provides a one vs.
one multi class algorithm.
Create a multi class SVM basing on the given "two-class-SVM", using the One versus One algorithm.
Definition at line 169 of file MultiClassSVMOneVsOne.hh.
typedef TriangularMatrix<double> svt::MultiClassSVMOneVsOne< SVM >::DetailedResultType |
Definition at line 184 of file MultiClassSVMOneVsOne.hh.
|
inline |
Create a multi class SVM basing on the given svm object.
svm | Two-Class Support vector maschine, the object is copied to internal variable |
Definition at line 213 of file MultiClassSVMOneVsOne.hh.
|
inline |
Create a multi class SVM.
with Default Constructot of template Parameter SVM
Definition at line 227 of file MultiClassSVMOneVsOne.hh.
|
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.
pr | pointer 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 247 of file MultiClassSVMOneVsOne.hh.
|
inline |
Definition at line 260 of file MultiClassSVMOneVsOne.hh.
|
inline |
Definition at line 270 of file MultiClassSVMOneVsOne.hh.
|
inline |
call the updateKernelCache() method of selected two-class svm
Definition at line 288 of file MultiClassSVMOneVsOne.hh.
|
inline |
call the clearKernelCache() method of selected two-class svm
Definition at line 307 of file MultiClassSVMOneVsOne.hh.
void svt::MultiClassSVMOneVsOne< SVM >::train | ( | const GroupedTrainingData< FV > & | trainData, |
typename Traits< FV >::ModelType & | model | ||
) | const |
train SVM with given Feature Vectors.
(raw interface)
this is the basic method, all others will call this one
trainData | Structure with pointers to feature-vectors |
model | (output) model containing a triangular matrix of trained of TwoClassModels. It stores only pointers to the feature vectors, but you still own them! |
Template Parameters:
Definition at line 109 of file MultiClassSVMOneVsOne.hh.
Referenced by svt::MultiClassSVMOneVsOne< SVM >::clearKernelCache(), and svt::MultiClassSVMOneVsOne< SVM >::train().
|
inline |
train SVM with given Feature Vectors.
(general SVM interface)
problem | Structure with pointers to feature-vectors and y's |
model | (output) model containing a triangular matrix of trained of TwoClassModels. It stores only pointers to the feature vectors, but you still own them! |
Definition at line 352 of file MultiClassSVMOneVsOne.hh.
|
inline |
train the Multi Class SVM with the given feature vectors.
The FeatureVector-Container must contain the Feature vectors directly, e.g., std::vector<MyFeatureVec>.
FV_begin | iterator to the first element of your FeatureVector-Container |
FV_end | iterator to one past the last element of your FeatureVector-Container |
model | (output) model containing a triangular matrix of trained of TwoClassModels. It stores only pointers to the feature vectors, but you still own them! |
Definition at line 383 of file MultiClassSVMOneVsOne.hh.
|
inline |
same as train(), but you can specify an Accessor for accessing the elements of your container.
This accessor must return a reference to the corresponding feature vector. Use DirectAccessor for containers like std::vector<FV> and DereferencingAccessor for containers like std::vector<FV*>
FVP_begin | iterator to the first element of your PointerToFeatureVector-Container |
FVP_end | iterator to one past the last element of your PointerToFeatureVector-Container |
model | (output) model containing a triangular matrix of trained of TwoClassModels. It stores only pointers to the feature vectors, but you still own them! |
accessor | functor, which accesses the feature vector in the container |
Definition at line 415 of file MultiClassSVMOneVsOne.hh.
void svt::MultiClassSVMOneVsOne< SVM >::retrainWithLeftOutVectors | ( | const GroupedTrainingData< FV > & | trainData, |
const typename Traits< FV >::ModelType & | fullModel, | ||
const std::vector< char > & | leaveOutFlagsByUID, | ||
typename Traits< FV >::ModelType & | resultingModel | ||
) | const |
calls the retrainWithLeftOutVectors() for each two-class model, only if the model is affected by the left out vectors
trainData | Structure with pointers to feature-vectors must be identical to training data set that was used to train the fullModel |
fullModel | model that was trained using complete training data set without leaving out anything |
leaveOutFlagsByUID | leave out flag for each feature vector, accessed via its uniqueID (true means leave this vector out from training) |
resultingModel | (output) model containing a triangular matrix of trained of TwoClassModels. It stores only pointers to the feature vectors, but you still own them! |
Definition at line 242 of file MultiClassSVMOneVsOne.hh.
Referenced by svt::MultiClassSVMOneVsOne< SVM >::train().
unsigned int svt::MultiClassSVMOneVsOne< SVM >::predictClassIndex | ( | const FV & | testObject, |
const typename Traits< FV >::ModelType & | model, | ||
ResultMatrix & | resultMatrix | ||
) | const |
classify the given testObject using the model
testObject | the test object | |
model | the model | |
[out] | resultMatrix | results (decision values) from the two-class classifications. resultMatrix (should be TriangularMatrix<double>) will be resized properly |
Definition at line 433 of file MultiClassSVMOneVsOne.hh.
Referenced by svt::MultiClassSVMOneVsOne< SVM >::classify(), svt::MultiClassSVMOneVsOne< SVM >::predictClassIndex(), and svt::MultiClassSVMOneVsOne< SVM >::train().
|
inline |
classify the given testObject using the model
testObject | the test object |
model | the model |
Definition at line 490 of file MultiClassSVMOneVsOne.hh.
|
inline |
classify the given testObject using the models in Model matrix.
testObject | the test object | |
model | the model | |
[out] | resultMatrix | results (decision values) from the two-class classifications. resultMatrix will be resized properly. The type could be the typedef'ed DetailedResultType or your own matrix class. |
Definition at line 515 of file MultiClassSVMOneVsOne.hh.
Referenced by svt::MultiClassSVMOneVsOne< SVM >::classify().
|
inline |
classify the given testObject using the model
testObject | the test object |
model | the model |
Definition at line 535 of file MultiClassSVMOneVsOne.hh.
|
inline |
Definition at line 544 of file MultiClassSVMOneVsOne.hh.
|
inline |
Definition at line 553 of file MultiClassSVMOneVsOne.hh.
|
inline |
save classification details.
Here the ordered lables as "labels" and the according decision values as "dec_values"
model | the used model |
resulMatrix | results from the classification |
stData | structured data, where to store the details |
Definition at line 572 of file MultiClassSVMOneVsOne.hh.
|
inlinestatic |
get information about the parameters, that are used in loadParameters() and saveParameters().
The Infos are appended to the passed array
p | array of ParamInfos. The Infos will be appended to this array |
Definition at line 590 of file MultiClassSVMOneVsOne.hh.
|
inlinestatic |
Definition at line 595 of file MultiClassSVMOneVsOne.hh.
Referenced by svt::MultiClassSVMOneVsOne< SVM >::saveParameters().
|
inlinestatic |
Definition at line 600 of file MultiClassSVMOneVsOne.hh.