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 88 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 22 of file Classifier.cpp.
~CClassifier | ( | ) | [virtual] |
Definition at line 27 of file Classifier.cpp.
virtual CLabels* classify | ( | ) | [pure virtual] |
classify objects using the currently set features
Implemented in CKernelMachine, CKNN, CLinearClassifier, CPluginEstimate, CMultiClassSVM, CWDSVMOcas, CHierarchical, CKMeans, and CKRR.
classify objects
data | (test)data to be classified |
Implemented in CKernelMachine, CKNN, CLinearClassifier, CPluginEstimate, 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 129 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, CGMNPSVM, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CScatterSVM, CSubGradientSVM, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CHierarchical, CKMeans, CKRR, CLibSVR, and CMKLRegression.
Definition at line 199 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 175 of file Classifier.h.
virtual CLabels* get_labels | ( | ) | [virtual] |
float64_t get_max_train_time | ( | ) |
get maximum training time
Definition at line 193 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 142 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 151 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 187 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, CGMNPSVM, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CScatterSVM, CSubGradientSVM, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CHierarchical, CKMeans, CKRR, and CLibSVR.
Definition at line 103 of file Classifier.h.
labels
Definition at line 237 of file Classifier.h.
float64_t max_train_time [protected] |
maximum training time
Definition at line 234 of file Classifier.h.
ESolverType solver_type [protected] |
solver type
Reimplemented in CLibSVM, and CLibSVMMultiClass.
Definition at line 240 of file Classifier.h.