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.
Public Member Functions | |
CClassifier () | |
virtual | ~CClassifier () |
virtual bool | train (CFeatures *data=NULL) |
virtual CLabels * | classify ()=0 |
virtual CLabels * | classify (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 CLabels * | get_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 |
CLabels * | labels |
ESolverType | solver_type |
CClassifier | ( | ) |
constructor
Definition at line 16 of file Classifier.cpp.
~CClassifier | ( | ) | [virtual] |
Definition at line 25 of file Classifier.cpp.
virtual CLabels* classify | ( | ) | [pure virtual] |
classify objects using the currently set features
Implemented in CDistanceMachine, CKernelMachine, CKNN, CLinearClassifier, CPluginEstimate, CMultiClassSVM, CWDSVMOcas, CHierarchical, CKMeans, and CKRR.
classify objects
data | (test)data to be classified |
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
num | which example to classify |
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] |
get classifier type
Reimplemented in CKernelPerceptron, CKNN, CLDA, CLPBoost, CLPM, CMKLClassification, CMKLMultiClass, CMKLOneClass, CPerceptron, CSubGradientLPM, CCPLEXSVM, CDomainAdaptationSVM, CDomainAdaptationSVMLinear, CGMNPSVM, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CScatterSVM, CSubGradientSVM, CSVMLight, CSVMLightOneClass, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CHierarchical, CKMeans, CKRR, CLibSVR, CMKLRegression, and CSVRLight.
Definition at line 201 of file Classifier.h.
virtual float64_t get_label | ( | int32_t | i | ) | [virtual] |
get one specific label
i | index of label to get |
Definition at line 177 of file Classifier.h.
virtual CLabels* get_labels | ( | ) | [virtual] |
float64_t get_max_train_time | ( | ) |
get maximum training time
Definition at line 195 of file Classifier.h.
ESolverType get_solver_type | ( | ) |
virtual bool load | ( | FILE * | srcfile | ) | [virtual] |
load Classifier from file
abstract base method
srcfile | file to load from |
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
dstfile | file to save to |
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] |
void set_max_train_time | ( | float64_t | t | ) |
set maximum training time
t | maximimum training time |
Definition at line 189 of file Classifier.h.
void set_solver_type | ( | ESolverType | st | ) |
virtual bool train | ( | CFeatures * | data = NULL |
) | [virtual] |
train classifier
data | training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data) |
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.
labels
Definition at line 220 of file Classifier.h.
float64_t max_train_time [protected] |
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.