SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DirectorKernelMachine.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 _DIRECTORKERNELMACHINE_H___
11 #define _DIRECTORKERNELMACHINE_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 CDirectorKernelMachine : public CKernelMachine
26 {
27  public:
28  /* default constructor */
29  CDirectorKernelMachine()
30  : CKernelMachine()
31  {
32 
33  }
34 
43  CDirectorKernelMachine(CKernel* k, const SGVector<float64_t> alphas, const SGVector<int32_t> svs, float64_t b)
44  : CKernelMachine(k, alphas, svs, b)
45  {
46  }
47 
48  /* destructor */
49  virtual ~CDirectorKernelMachine()
50  {
51 
52  }
53 
63  virtual bool train(CFeatures* data=NULL)
64  {
65  return CKernelMachine::train(data);
66  }
67 
68  virtual bool train_function(CFeatures* data=NULL)
69  {
70  SG_ERROR("Train function of Director Kernel Machine needs to be overridden.\n")
71  return false;
72  }
73 
80  virtual CLabels* apply(CFeatures* data=NULL)
81  {
82  return CKernelMachine::apply(data);
83  }
84 
86  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL)
87  {
88  return CKernelMachine::apply_binary(data);
89  }
90 
92  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL)
93  {
95  }
96 
99 
105  virtual float64_t apply_one(int32_t num)
106  {
107  return CKernelMachine::apply_one(num);
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_DIRECTORKERNEL; }
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 CKernelMachine::train_locked(indices);
155  }
156 
162  virtual CLabels* apply_locked(SGVector<index_t> indices)
163  {
164  return CKernelMachine::apply_locked(indices);
165  }
166 
167  virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
168  {
169  return CKernelMachine::apply_locked_binary(indices);
170  }
171 
172  virtual CRegressionLabels* apply_locked_regression(
173  SGVector<index_t> indices)
174  {
176  }
177 
179 
186  virtual SGVector<float64_t> apply_locked_get_output(
187  SGVector<index_t> indices)
188  {
190  }
191 
200  virtual void data_lock(CLabels* labs, CFeatures* features)
201  {
202  CKernelMachine::data_lock(labs, features);
203  }
204 
206  virtual void data_unlock()
207  {
209  }
210 
212  virtual bool supports_locking() const
213  {
215  }
216 
217  //TODO change to pure virtual
218  virtual EProblemType get_machine_problem_type() const
219  {
221  }
222 
223  virtual const char* get_name() const { return "DirectorKernelMachine"; }
224 
225  protected:
236  virtual bool train_machine(CFeatures* data=NULL)
237  {
238  return train_function(data);
239  }
240 };
241 
242 }
243 
244 #endif /* USE_SWIG_DIRECTORS */
245 #endif /* _DIRECTORKERNELMACHINE_H___ */
virtual float64_t apply_one(int32_t num)
EMachineType
Definition: Machine.h:33
virtual CBinaryLabels * apply_locked_binary(SGVector< index_t > indices)
virtual CLabels * apply_locked(SGVector< index_t > indices)
Definition: Machine.cpp:187
virtual CRegressionLabels * apply_regression(CFeatures *data=NULL)
#define SG_ERROR(...)
Definition: SGIO.h:129
virtual bool train_locked(SGVector< index_t > indices)
virtual void set_store_model_features(bool store_model)
Definition: Machine.cpp:107
EProblemType
Definition: Machine.h:110
virtual SGVector< float64_t > apply_locked_get_output(SGVector< index_t > indices)
double float64_t
Definition: common.h:50
virtual void data_unlock()
virtual CLabels * get_labels()
Definition: Machine.cpp:76
virtual bool supports_locking() const
virtual EProblemType get_machine_problem_type() const
Definition: Machine.h:299
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 CRegressionLabels * apply_locked_regression(SGVector< index_t > indices)
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 CBinaryLabels * apply_binary(CFeatures *data=NULL)
virtual void data_lock(CLabels *labs, CFeatures *features=NULL)
virtual CLabels * apply(CFeatures *data=NULL)
Definition: Machine.cpp:152

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