SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NearestCentroid.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2012 Philippe Tillet
8  */
9 
10 #ifndef _NEAREST_CENTROID_H__
11 #define _NEAREST_CENTROID_H__
12 
13 #include <shogun/lib/config.h>
14 
15 #include <shogun/lib/common.h>
16 #include <shogun/io/SGIO.h>
21 
22 namespace shogun
23 {
24 
25 class CDistanceMachine;
26 
34 
35 public:
36 
39 
44 
51 
54  virtual ~CNearestCentroid();
55 
60  void set_shrinking(float64_t shrinking) {
61  m_shrinking = shrinking ;
62  }
63 
69  return m_shrinking;
70  }
71 
77  return m_centroids;
78  }
79 
84  virtual const char* get_name() const { return "NearestCentroid"; }
85 
86 protected:
95  virtual bool train_machine(CFeatures* data=NULL);
96 
102 private:
103  void init();
104 
105 protected:
107  int32_t m_num_classes;
108 
111 
114 
117 };
118 
119 }
120 
121 #endif
bool m_is_trained
Tells if the classifier has been trained or not.
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:81
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
virtual const char * get_name() const
void set_shrinking(float64_t shrinking)
float64_t m_shrinking
Shrinking parameter.
A generic DistanceMachine interface.
CDenseFeatures< float64_t > * get_centroids() const
float64_t get_shrinking() const
double float64_t
Definition: common.h:50
Class NearestCentroid, an implementation of Nearest Shrunk Centroid classifier.
CDenseFeatures< float64_t > * m_centroids
The centroids of the trained features.
virtual bool train_machine(CFeatures *data=NULL)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
int32_t m_num_classes
number of classes (i.e. number of values labels can take)
MACHINE_PROBLEM_TYPE(PT_MULTICLASS)

SHOGUN Machine Learning Toolbox - Documentation