SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DirectorLinearMachine.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  * Copyright (C) 2012 Evgeniy Andreev (gsomix)
8  */
9 
10 #ifndef _DIRECTORLINEARMACHINE_H___
11 #define _DIRECTORLINEARMACHINE_H___
12 
13 #include <shogun/lib/config.h>
14 
15 #ifdef USE_SWIG_DIRECTORS
16 #include <shogun/lib/common.h>
17 #include <shogun/lib/DataType.h>
18 #include <shogun/machine/Machine.h>
20 
21 namespace shogun
22 {
23 
24 #define IGNORE_IN_CLASSLIST
25 IGNORE_IN_CLASSLIST class CDirectorLinearMachine : public CLinearMachine
26 {
27  public:
28  /* default constructor */
29  CDirectorLinearMachine()
30  : CLinearMachine()
31  {
32 
33  }
34 
35  /* destructor */
36  virtual ~CDirectorLinearMachine()
37  {
38 
39  }
40 
50  virtual bool train(CFeatures* data=NULL)
51  {
52  return CLinearMachine::train(data);
53  }
54 
55  virtual bool train_function(CFeatures* data=NULL)
56  {
57  SG_ERROR("Train function of Director Linear Machine needs to be overridden.\n")
58  return false;
59  }
60 
65  virtual void set_features(CDotFeatures* feat)
66  {
68  }
69 
74  virtual CDotFeatures* get_features()
75  {
77  }
78 
85  virtual CLabels* apply(CFeatures* data=NULL)
86  {
87  return CLinearMachine::apply(data);
88  }
89 
91  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL)
92  {
93  return CLinearMachine::apply_binary(data);
94  }
95 
97  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL)
98  {
100  }
101 
104 
105  virtual float64_t apply_one(int32_t vec_idx)
106  {
107  return CLinearMachine::apply_one(vec_idx);
108  }
109 
114  virtual void set_labels(CLabels* lab)
115  {
117  }
118 
123  virtual CLabels* get_labels()
124  {
126  }
127 
132  virtual EMachineType get_classifier_type() { return CT_DIRECTORLINEAR; }
133 
139  virtual void set_store_model_features(bool store_model)
140  {
142  }
143 
152  virtual bool train_locked(SGVector<index_t> indices)
153  {
154  return CLinearMachine::train_locked(indices);
155  }
156 
162  virtual CLabels* apply_locked(SGVector<index_t> indices)
163  {
164  return CLinearMachine::apply_locked(indices);
165  }
166 
167  virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
168  {
169  return CLinearMachine::apply_locked_binary(indices);
170  }
171 
172  virtual CRegressionLabels* apply_locked_regression(
173  SGVector<index_t> indices)
174  {
176  }
177 
179 
188  virtual void data_lock(CLabels* labs, CFeatures* features)
189  {
190  CLinearMachine::data_lock(labs, features);
191  }
192 
194  virtual void data_unlock()
195  {
197  }
198 
200  virtual bool supports_locking() const
201  {
203  }
204 
205  //TODO change to pure virtual
206  virtual EProblemType get_machine_problem_type() const
207  {
209  }
210 
211  virtual const char* get_name() const { return "DirectorLinearMachine"; }
212 
213  protected:
224  virtual bool train_machine(CFeatures* data=NULL)
225  {
226  return train_function(data);
227  }
228 };
229 
230 }
231 
232 #endif /* USE_SWIG_DIRECTORS */
233 #endif /* _DIRECTORLINEARMACHINE_H___ */
virtual CBinaryLabels * apply_binary(CFeatures *data=NULL)
EMachineType
Definition: Machine.h:33
virtual CRegressionLabels * apply_regression(CFeatures *data=NULL)
virtual CLabels * apply_locked(SGVector< index_t > indices)
Definition: Machine.cpp:187
#define SG_ERROR(...)
Definition: SGIO.h:129
virtual CDotFeatures * get_features()
virtual bool train_locked(SGVector< index_t > indices)
Definition: Machine.h:239
virtual float64_t apply_one(int32_t vec_idx)
virtual void set_store_model_features(bool store_model)
Definition: Machine.cpp:107
EProblemType
Definition: Machine.h:110
double float64_t
Definition: common.h:50
virtual void data_unlock()
Definition: Machine.cpp:143
virtual void data_lock(CLabels *labs, CFeatures *features)
Definition: Machine.cpp:112
virtual CLabels * get_labels()
Definition: Machine.cpp:76
virtual void set_features(CDotFeatures *feat)
virtual EProblemType get_machine_problem_type() const
Definition: Machine.h:299
virtual CRegressionLabels * apply_locked_regression(SGVector< index_t > indices)
Definition: Machine.cpp:245
virtual bool supports_locking() const
Definition: Machine.h:293
virtual CMulticlassLabels * apply_locked_multiclass(SGVector< index_t > indices)
Definition: Machine.cpp:252
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define IGNORE_IN_CLASSLIST
Definition: CPLEXSVM.h:24
virtual CBinaryLabels * apply_locked_binary(SGVector< index_t > indices)
Definition: Machine.cpp:238
virtual bool train(CFeatures *data=NULL)
Definition: Machine.cpp:39
virtual CMulticlassLabels * apply_multiclass(CFeatures *data=NULL)
Definition: Machine.cpp:220
virtual void set_labels(CLabels *lab)
Definition: Machine.cpp:65
virtual CLabels * apply(CFeatures *data=NULL)
Definition: Machine.cpp:152

SHOGUN 机器学习工具包 - 项目文档