SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Machine.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  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _MACHINE_H__
12 #define _MACHINE_H__
13 
14 #include <shogun/lib/common.h>
15 #include <shogun/base/SGObject.h>
16 #include <shogun/features/Labels.h>
18 
19 namespace shogun
20 {
21 
22 class CFeatures;
23 class CLabels;
24 class CMath;
25 
28 {
29  CT_NONE = 0,
30  CT_LIGHT = 10,
32  CT_LIBSVM = 20,
35  CT_MPD = 50,
36  CT_GPBT = 60,
40  CT_LDA = 100,
41  CT_LPM = 110,
42  CT_LPBOOST = 120,
43  CT_KNN = 130,
44  CT_SVMLIN=140,
45  CT_KRR = 150,
46  CT_GNPPSVM = 160,
47  CT_GMNPSVM = 170,
50  CT_SVMPERF = 200,
51  CT_LIBSVR = 210,
52  CT_SVRLIGHT = 220,
53  CT_LIBLINEAR = 230,
54  CT_KMEANS = 240,
56  CT_SVMOCAS = 260,
57  CT_WDSVMOCAS = 270,
58  CT_SVMSGD = 280,
64  CT_DASVM = 340,
65  CT_LARANK = 350,
69  CT_SGDQN = 390,
70 
71 };
72 
75 {
83 };
84 
96 class CMachine : public CSGObject
97 {
98  public:
100  CMachine();
101 
103  virtual ~CMachine();
104 
114  virtual bool train(CFeatures* data=NULL);
115 
120  virtual CLabels* apply()=0;
121 
127  virtual CLabels* apply(CFeatures* data)=0;
128 
136  virtual float64_t apply(int32_t num);
137 
145  virtual bool load(FILE* srcfile);
146 
154  virtual bool save(FILE* dstfile);
155 
160  virtual void set_labels(CLabels* lab);
161 
166  virtual CLabels* get_labels();
167 
173  virtual float64_t get_label(int32_t i);
174 
180 
186 
192 
197  void set_solver_type(ESolverType st);
198 
204 
210  virtual void set_store_model_features(bool store_model);
211 
212  protected:
223  virtual bool train_machine(CFeatures* data=NULL)
224  {
225  SG_ERROR("train_machine is not yet implemented for %s!\n",
226  get_name());
227  return false;
228  }
229 
240  virtual void store_model_features()
241  {
242  SG_ERROR("Model storage and therefore Cross-Validation and "
243  "Model-Selection is not supported for %s\n", get_name());
244  }
245 
246  protected:
249 
252 
255 
258 };
259 }
260 #endif // _MACHINE_H__
virtual const char * get_name() const =0
void set_max_train_time(float64_t t)
Definition: Machine.cpp:84
virtual CLabels * apply()=0
virtual bool load(FILE *srcfile)
Definition: Machine.cpp:51
virtual float64_t get_label(int32_t i)
Definition: Machine.cpp:76
EClassifierType
Definition: Machine.h:27
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
ESolverType
Definition: Machine.h:74
#define SG_ERROR(...)
Definition: SGIO.h:75
virtual bool train_machine(CFeatures *data=NULL)
Definition: Machine.h:223
bool m_store_model_features
Definition: Machine.h:257
A generic learning machine interface.
Definition: Machine.h:96
CLabels * labels
Definition: Machine.h:251
virtual void set_store_model_features(bool store_model)
Definition: Machine.cpp:109
virtual ~CMachine()
Definition: Machine.cpp:30
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:76
virtual bool save(FILE *dstfile)
Definition: Machine.cpp:57
double float64_t
Definition: common.h:56
float64_t max_train_time
Definition: Machine.h:248
virtual EClassifierType get_classifier_type()
Definition: Machine.cpp:94
virtual CLabels * get_labels()
Definition: Machine.cpp:70
float64_t get_max_train_time()
Definition: Machine.cpp:89
ESolverType get_solver_type()
Definition: Machine.cpp:104
virtual void store_model_features()
Definition: Machine.h:240
The class Features is the base class of all feature objects.
Definition: Features.h:56
virtual bool train(CFeatures *data=NULL)
Definition: Machine.cpp:35
ESolverType solver_type
Definition: Machine.h:254
virtual void set_labels(CLabels *lab)
Definition: Machine.cpp:63
void set_solver_type(ESolverType st)
Definition: Machine.cpp:99

SHOGUN Machine Learning Toolbox - Documentation