Public Member Functions | Protected Attributes

CClassifier Class Reference


Detailed Description

A generic classifier interface.

A classifier takes as input CLabels. Later subclasses may specialize the classifier to require labels and a kernel or labels and (real-valued) features.

A classifier needs to override the train() function for training, the function classify_example() (optionally classify() to predict on the whole set of examples) and the load and save routines.

Definition at line 90 of file Classifier.h.

Inheritance diagram for CClassifier:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CClassifier ()
virtual ~CClassifier ()
virtual bool train (CFeatures *data=NULL)
virtual CLabelsclassify ()=0
virtual CLabelsclassify (CFeatures *data)=0
virtual float64_t classify_example (int32_t num)
virtual bool load (FILE *srcfile)
virtual bool save (FILE *dstfile)
virtual void set_labels (CLabels *lab)
virtual CLabelsget_labels ()
virtual float64_t get_label (int32_t i)
void set_max_train_time (float64_t t)
float64_t get_max_train_time ()
virtual EClassifierType get_classifier_type ()
void set_solver_type (ESolverType st)
ESolverType get_solver_type ()

Protected Attributes

float64_t max_train_time
CLabelslabels
ESolverType solver_type

Constructor & Destructor Documentation

CClassifier (  ) 

constructor

Definition at line 16 of file Classifier.cpp.

~CClassifier (  )  [virtual]

Definition at line 25 of file Classifier.cpp.


Member Function Documentation

virtual CLabels* classify (  )  [pure virtual]

classify objects using the currently set features

Returns:
classified labels

Implemented in CDistanceMachine, CKernelMachine, CKNN, CLinearClassifier, CPluginEstimate, CMultiClassSVM, CWDSVMOcas, CHierarchical, CKMeans, and CKRR.

virtual CLabels* classify ( CFeatures data  )  [pure virtual]

classify objects

Parameters:
data (test)data to be classified
Returns:
classified labels

Implemented in CDistanceMachine, CKernelMachine, CKNN, CLinearClassifier, CPluginEstimate, CDomainAdaptationSVM, CWDSVMOcas, CHierarchical, CKMeans, and CKRR.

virtual float64_t classify_example ( int32_t  num  )  [virtual]

classify one example

abstract base method

Parameters:
num which example to classify
Returns:
infinite float value

Reimplemented in CKernelMachine, CKernelPerceptron, CKNN, CLinearClassifier, CPluginEstimate, CMultiClassSVM, CScatterSVM, CWDSVMOcas, and CKRR.

Definition at line 131 of file Classifier.h.

virtual EClassifierType get_classifier_type (  )  [virtual]
virtual float64_t get_label ( int32_t  i  )  [virtual]

get one specific label

Parameters:
i index of label to get
Returns:
value of label at index i

Definition at line 177 of file Classifier.h.

virtual CLabels* get_labels (  )  [virtual]

get labels

Returns:
labels

Definition at line 170 of file Classifier.h.

float64_t get_max_train_time (  ) 

get maximum training time

Returns:
maximum training time

Definition at line 195 of file Classifier.h.

ESolverType get_solver_type (  ) 

get solver type

Returns:
solver

Definition at line 213 of file Classifier.h.

virtual bool load ( FILE *  srcfile  )  [virtual]

load Classifier from file

abstract base method

Parameters:
srcfile file to load from
Returns:
failure

Reimplemented in CKernelPerceptron, CKNN, CLinearClassifier, CMultiClassSVM, CSVM, CHierarchical, CKMeans, and CKRR.

Definition at line 144 of file Classifier.h.

virtual bool save ( FILE *  dstfile  )  [virtual]

save Classifier to file

abstract base method

Parameters:
dstfile file to save to
Returns:
failure

Reimplemented in CKernelPerceptron, CKNN, CLinearClassifier, CMultiClassSVM, CSVM, CHierarchical, CKMeans, and CKRR.

Definition at line 153 of file Classifier.h.

virtual void set_labels ( CLabels lab  )  [virtual]

set labels

Parameters:
lab labels

Definition at line 159 of file Classifier.h.

void set_max_train_time ( float64_t  t  ) 

set maximum training time

Parameters:
t maximimum training time

Definition at line 189 of file Classifier.h.

void set_solver_type ( ESolverType  st  ) 

set solver type

Parameters:
st solver type

Definition at line 207 of file Classifier.h.

virtual bool train ( CFeatures data = NULL  )  [virtual]

train classifier

Parameters:
data training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data)
Returns:
whether training was successful

Reimplemented in CKernelPerceptron, CKNN, CLDA, CLPBoost, CLPM, CMKL, CMKLMultiClass, CPerceptron, CPluginEstimate, CSubGradientLPM, CCPLEXSVM, CDomainAdaptationSVM, CGMNPSVM, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CScatterSVM, CSubGradientSVM, CSVMLight, CSVMLightOneClass, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CHierarchical, CKMeans, CKRR, CLibSVR, and CSVRLight.

Definition at line 105 of file Classifier.h.


Member Data Documentation

CLabels* labels [protected]

labels

Definition at line 220 of file Classifier.h.

maximum training time

Definition at line 217 of file Classifier.h.

ESolverType solver_type [protected]

solver type

Reimplemented in CLibSVM, and CLibSVMMultiClass.

Definition at line 223 of file Classifier.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation