SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SVM.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 _SVM_H___
12 #define _SVM_H___
13 
14 #include <shogun/lib/common.h>
16 #include <shogun/kernel/Kernel.h>
18 
19 namespace shogun
20 {
21 
22 class CMKL;
23 
46 class CSVM : public CKernelMachine
47 {
48  public:
52  CSVM(int32_t num_sv=0);
53 
61  CSVM(float64_t C, CKernel* k, CLabels* lab);
62  virtual ~CSVM();
63 
66  void set_defaults(int32_t num_sv=0);
67 
68 
75 
76 
82  virtual void set_linear_term(SGVector<float64_t> linear_term);
83 
84 
88  bool load(FILE* svm_file);
89 
93  bool save(FILE* svm_file);
94 
99  inline void set_nu(float64_t nue) { nu=nue; }
100 
101 
110  inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
111 
112 
117  inline void set_epsilon(float64_t eps) { epsilon=eps; }
118 
123  inline void set_tube_epsilon(float64_t eps) { tube_epsilon=eps; }
124 
130 
135  inline void set_qpsize(int32_t qps) { qpsize=qps; }
136 
141  inline float64_t get_epsilon() { return epsilon; }
142 
147  inline float64_t get_nu() { return nu; }
148 
153  inline float64_t get_C1() { return C1; }
154 
159  inline float64_t get_C2() { return C2; }
160 
165  inline int32_t get_qpsize() { return qpsize; }
166 
171  inline void set_shrinking_enabled(bool enable)
172  {
173  use_shrinking=enable;
174  }
175 
180  inline bool get_shrinking_enabled()
181  {
182  return use_shrinking;
183  }
184 
190 
196 
201  inline void set_objective(float64_t v)
202  {
203  objective=v;
204  }
205 
211  {
212  return objective;
213  }
214 
222  void set_callback_function(CMKL* m, bool (*cb)
223  (CMKL* mkl, const float64_t* sumw, const float64_t suma));
224 
226  inline virtual const char* get_name() const { return "SVM"; }
227 
228  protected:
229 
235  virtual float64_t* get_linear_term_array();
236 
239 
255  int32_t qpsize;
258 
261  bool (*callback) (CMKL* mkl, const float64_t* sumw, const float64_t suma);
265 };
266 }
267 #endif

SHOGUN Machine Learning Toolbox - Documentation