SHOGUN  6.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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 #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 
144 #ifndef SWIG // SWIG should skip this part
145 
153  virtual bool train_locked(SGVector<index_t> indices)
154  {
155  return CKernelMachine::train_locked(indices);
156  }
157 
158 
164  virtual CLabels* apply_locked(SGVector<index_t> indices)
165  {
166  return CKernelMachine::apply_locked(indices);
167  }
168 
169  virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
170  {
171  return CKernelMachine::apply_locked_binary(indices);
172  }
173 
174  virtual CRegressionLabels* apply_locked_regression(
175  SGVector<index_t> indices)
176  {
178  }
179 
181 
188  virtual SGVector<float64_t> apply_locked_get_output(
189  SGVector<index_t> indices)
190  {
192  }
193 #endif // SWIG // SWIG should skip this part
194 
203  virtual void data_lock(CLabels* labs, CFeatures* features)
204  {
205  CKernelMachine::data_lock(labs, features);
206  }
207 
209  virtual void data_unlock()
210  {
212  }
213 
215  virtual bool supports_locking() const
216  {
218  }
219 
220  //TODO change to pure virtual
221  virtual EProblemType get_machine_problem_type() const
222  {
224  }
225 
226  virtual const char* get_name() const { return "DirectorKernelMachine"; }
227 
228  protected:
239  virtual bool train_machine(CFeatures* data=NULL)
240  {
241  return train_function(data);
242  }
243 };
244 
245 }
246 
247 #endif /* USE_SWIG_DIRECTORS */
248 #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:128
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:60
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:303
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 Machine Learning Toolbox - Documentation