SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DirectorKernelMachine.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  * Copyright (C) 2012 Evgeniy Andreev (gsomix)
8  */
9 
10 #ifndef _DIRECTORKERNELMACHINE_H___
11 #define _DIRECTORKERNELMACHINE_H___
12 
13 #ifdef USE_SWIG_DIRECTORS
14 #include <shogun/lib/common.h>
15 #include <shogun/lib/DataType.h>
16 #include <shogun/machine/Machine.h>
18 
19 namespace shogun
20 {
21 
22 #define IGNORE_IN_CLASSLIST
23 IGNORE_IN_CLASSLIST class CDirectorKernelMachine : public CKernelMachine
24 {
25  public:
26  /* default constructor */
27  CDirectorKernelMachine()
28  : CKernelMachine()
29  {
30 
31  }
32 
41  CDirectorKernelMachine(CKernel* k, const SGVector<float64_t> alphas, const SGVector<int32_t> svs, float64_t b)
42  : CKernelMachine(k, alphas, svs, b)
43  {
44  }
45 
46  /* destructor */
47  virtual ~CDirectorKernelMachine()
48  {
49 
50  }
51 
61  virtual bool train(CFeatures* data=NULL)
62  {
63  return CKernelMachine::train(data);
64  }
65 
66  virtual bool train_function(CFeatures* data=NULL)
67  {
68  SG_ERROR("Train function of Director Kernel Machine needs to be overridden.\n")
69  return false;
70  }
71 
78  virtual CLabels* apply(CFeatures* data=NULL)
79  {
80  return CKernelMachine::apply(data);
81  }
82 
84  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL)
85  {
86  return CKernelMachine::apply_binary(data);
87  }
88 
90  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL)
91  {
93  }
94 
97 
103  virtual float64_t apply_one(int32_t num)
104  {
105  return CKernelMachine::apply_one(num);
106  }
107 
112  virtual void set_labels(CLabels* lab)
113  {
115  }
116 
121  virtual CLabels* get_labels()
122  {
124  }
125 
130  virtual EMachineType get_classifier_type() { return CT_DIRECTORKERNEL; }
131 
137  virtual void set_store_model_features(bool store_model)
138  {
140  }
141 
150  virtual bool train_locked(SGVector<index_t> indices)
151  {
152  return CKernelMachine::train_locked(indices);
153  }
154 
160  virtual CLabels* apply_locked(SGVector<index_t> indices)
161  {
162  return CKernelMachine::apply_locked(indices);
163  }
164 
165  virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
166  {
167  return CKernelMachine::apply_locked_binary(indices);
168  }
169 
170  virtual CRegressionLabels* apply_locked_regression(
171  SGVector<index_t> indices)
172  {
174  }
175 
177 
184  virtual SGVector<float64_t> apply_locked_get_output(
185  SGVector<index_t> indices)
186  {
188  }
189 
198  virtual void data_lock(CLabels* labs, CFeatures* features)
199  {
200  CKernelMachine::data_lock(labs, features);
201  }
202 
204  virtual void data_unlock()
205  {
207  }
208 
210  virtual bool supports_locking() const
211  {
213  }
214 
215  //TODO change to pure virtual
216  virtual EProblemType get_machine_problem_type() const
217  {
219  }
220 
221  virtual const char* get_name() const { return "DirectorKernelMachine"; }
222 
223  protected:
234  virtual bool train_machine(CFeatures* data=NULL)
235  {
236  return train_function(data);
237  }
238 };
239 
240 }
241 
242 #endif /* USE_SWIG_DIRECTORS */
243 #endif /* _DIRECTORKERNELMACHINE_H___ */

SHOGUN Machine Learning Toolbox - Documentation