SHOGUN  6.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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 
144 #ifndef SWIG // SWIG should skip this part
145 
153  virtual bool train_locked(SGVector<index_t> indices)
154  {
155  return CLinearMachine::train_locked(indices);
156  }
157 
163  virtual CLabels* apply_locked(SGVector<index_t> indices)
164  {
165  return CLinearMachine::apply_locked(indices);
166  }
167 
168  virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices)
169  {
170  return CLinearMachine::apply_locked_binary(indices);
171  }
172 
173  virtual CRegressionLabels* apply_locked_regression(
174  SGVector<index_t> indices)
175  {
177  }
178 
180 #endif // SWIG // SWIG should skip this part
181 
190  virtual void data_lock(CLabels* labs, CFeatures* features)
191  {
192  CLinearMachine::data_lock(labs, features);
193  }
194 
196  virtual void data_unlock()
197  {
199  }
200 
202  virtual bool supports_locking() const
203  {
205  }
206 
207  //TODO change to pure virtual
208  virtual EProblemType get_machine_problem_type() const
209  {
211  }
212 
213  virtual const char* get_name() const { return "DirectorLinearMachine"; }
214 
215  protected:
226  virtual bool train_machine(CFeatures* data=NULL)
227  {
228  return train_function(data);
229  }
230 };
231 
232 }
233 
234 #endif /* USE_SWIG_DIRECTORS */
235 #endif /* _DIRECTORLINEARMACHINE_H___ */
virtual CBinaryLabels * apply_binary(CFeatures *data=NULL)
EMachineType
Definition: Machine.h:33
virtual bool train(CFeatures *data=NULL)
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:128
virtual CDotFeatures * get_features()
virtual bool train_locked(SGVector< index_t > indices)
Definition: Machine.h:240
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:60
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:303
virtual CRegressionLabels * apply_locked_regression(SGVector< index_t > indices)
Definition: Machine.cpp:245
virtual bool supports_locking() const
Definition: Machine.h:297
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 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 Machine Learning Toolbox - Documentation