Definition at line 25 of file KNN.h.
Public Member Functions | |
CKNN () | |
CKNN (INT k, CDistance *d, CLabels *trainlab) | |
virtual | ~CKNN () |
virtual EClassifierType | get_classifier_type () |
virtual bool | train () |
virtual CLabels * | classify (CLabels *output=NULL) |
virtual DREAL | classify_example (INT vec_idx) |
get output for example "vec_idx" | |
virtual bool | load (FILE *srcfile) |
virtual bool | save (FILE *dstfile) |
void | set_k (DREAL p_k) |
DREAL | get_k () |
void | set_distance (CDistance *d) |
CDistance * | get_distance () |
virtual void | set_labels (CLabels *lab) |
virtual CLabels * | get_labels () |
virtual DREAL | get_label (INT i) |
void | set_max_train_time (DREAL t) |
DREAL | get_max_train_time () |
Static Public Attributes | |
static CParallel | parallel |
static CIO | io |
static CVersion | version |
Protected Attributes | |
DREAL | k |
the k parameter in KNN | |
int | num_classes |
number of classes (i.e. number of values labels can take) | |
int | min_label |
smallest label, i.e. -1 | |
int | num_train_labels |
number of train examples | |
INT * | train_labels |
the actual trainlabels | |
CDistance * | distance |
DREAL | max_train_time |
CLabels * | labels |
virtual EClassifierType CKNN::get_classifier_type | ( | ) | [virtual] |
bool CKNN::train | ( | ) | [virtual] |
classify all examples
output | resulting labels |
histogram of classes and returned output
Reimplemented from CClassifier.
bool CKNN::load | ( | FILE * | srcfile | ) | [virtual] |
load from file
srcfile | file to load from |
Reimplemented from CClassifier.
bool CKNN::save | ( | FILE * | dstfile | ) | [virtual] |
save to file
dstfile | file to save to |
Reimplemented from CClassifier.
void CDistanceMachine::set_distance | ( | CDistance * | d | ) | [inherited] |
CDistance* CDistanceMachine::get_distance | ( | ) | [inherited] |
virtual void CClassifier::set_labels | ( | CLabels * | lab | ) | [virtual, inherited] |
virtual CLabels* CClassifier::get_labels | ( | ) | [virtual, inherited] |
get one specific label
i | index of label to get |
Definition at line 89 of file Classifier.h.
void CClassifier::set_max_train_time | ( | DREAL | t | ) | [inherited] |
set maximum training time
t | maximimum training time |
Definition at line 95 of file Classifier.h.
DREAL CClassifier::get_max_train_time | ( | ) | [inherited] |
get maximum training time
Definition at line 101 of file Classifier.h.
int CKNN::num_classes [protected] |
int CKNN::min_label [protected] |
int CKNN::num_train_labels [protected] |
INT* CKNN::train_labels [protected] |
CDistance* CDistanceMachine::distance [protected, inherited] |
the distance
Definition at line 49 of file DistanceMachine.h.
DREAL CClassifier::max_train_time [protected, inherited] |
maximum training time
Definition at line 111 of file Classifier.h.
CLabels* CClassifier::labels [protected, inherited] |
labels
Definition at line 114 of file Classifier.h.
CParallel CSGObject::parallel [static, inherited] |
Definition at line 105 of file SGObject.h.
CIO CSGObject::io [static, inherited] |
Definition at line 106 of file SGObject.h.
CVersion CSGObject::version [static, inherited] |
Definition at line 107 of file SGObject.h.