SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DirectorLinearMachine.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 _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___ */

SHOGUN Machine Learning Toolbox - Documentation