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__

SHOGUN Machine Learning Toolbox - Documentation