28 class CDistanceMachine;
100 SG_ERROR(
"for performance reasons use apply() instead of apply(int32_t vec_idx)\n")
114 virtual bool load(FILE* srcfile);
121 virtual bool save(FILE* dstfile);
170 virtual const char*
get_name()
const {
return "KNN"; }
214 int32_t choose_class(
float64_t* classes, int32_t* train_lab);
228 void choose_class_for_multiple_k(int32_t* output, int32_t* classes, int32_t* train_lab, int32_t step);
virtual void store_model_features()
virtual bool save(FILE *dstfile)
virtual EMachineType get_classifier_type()
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()
int32_t m_min_label
smallest label, i.e. -1
virtual bool train_machine(CFeatures *data=NULL)
SGMatrix< index_t > nearest_neighbors()
A generic DistanceMachine interface.
virtual bool load(FILE *srcfile)
int32_t m_num_classes
number of classes (i.e. number of values labels can take)
Multiclass Labels for multi-class classification.
int32_t m_k
the k parameter in KNN
void set_use_covertree(bool use_covertree)
#define MACHINE_PROBLEM_TYPE(PT)
Class KNN, an implementation of the standard k-nearest neigbor classifier.
float64_t m_q
parameter q of rank weighting
SGVector< int32_t > m_train_labels
bool get_use_covertree() const
all of classes and functions are contained in the shogun namespace
virtual const char * get_name() const
The class Features is the base class of all feature objects.
virtual CMulticlassLabels * classify_NN()
virtual CMulticlassLabels * apply_multiclass(CFeatures *data=NULL)
virtual float64_t apply_one(int32_t vec_idx)
get output for example "vec_idx"
bool m_use_covertree
parameter to enable cover tree support