SHOGUN  v3.2.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 
NearestCentroid.h
浏览该文件的文档.
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 <stdio.h>
14 #include <shogun/lib/common.h>
15 #include <shogun/io/SGIO.h>
20 
21 namespace shogun
22 {
23 
24 class CDistanceMachine;
25 
33 
34 public:
35 
38 
43 
50 
53  virtual ~CNearestCentroid();
54 
59  void set_shrinking(float64_t shrinking) {
60  m_shrinking = shrinking ;
61  }
62 
68  return m_shrinking;
69  }
70 
76  return m_centroids;
77  }
78 
83  virtual const char* get_name() const { return "NearestCentroid"; }
84 
85 protected:
94  virtual bool train_machine(CFeatures* data=NULL);
95 
101 private:
102  void init();
103 
104 protected:
106  int32_t m_num_classes;
107 
110 
113 
116 };
117 
118 }
119 
120 #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:80
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
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:48
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:16
The class Features is the base class of all feature objects.
Definition: Features.h:62
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