25 class CDistanceMachine;
91 SG_ERROR(
"for performance reasons use apply() instead of apply(int32_t vec_idx)\n");
105 virtual bool load(FILE* srcfile);
112 virtual bool save(FILE* dstfile);
148 inline virtual const char*
get_name()
const {
return "KNN"; }
virtual void store_model_features()
virtual bool save(FILE *dstfile)
Class Distance, a base class for all the distances used in the Shogun toolbox.
void init_distance(CFeatures *data)
The class Labels models labels, i.e. class assignments of objects.
SGMatrix< int32_t > classify_for_multiple_k()
virtual float64_t apply(int32_t vec_idx)
get output for example "vec_idx"
virtual CLabels * classify_NN()
virtual bool train_machine(CFeatures *data=NULL)
A generic DistanceMachine interface.
virtual bool load(FILE *srcfile)
virtual CLabels * apply()
int32_t m_k
the k parameter in KNN
int32_t num_classes
number of classes (i.e. number of values labels can take)
int32_t min_label
smallest label, i.e. -1
SGVector< int32_t > train_labels
Class KNN, an implementation of the standard k-nearest neigbor classifier.
float64_t m_q
parameter q of rank weighting
virtual const char * get_name() const
The class Features is the base class of all feature objects.
virtual EClassifierType get_classifier_type()