SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KernelMachine.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  * Written (W) 2011-2012 Heiko Strathmann
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _KERNEL_MACHINE_H__
13 #define _KERNEL_MACHINE_H__
14 
15 #include <shogun/lib/config.h>
16 
17 #include <shogun/lib/common.h>
18 #include <shogun/machine/Machine.h>
19 #include <shogun/lib/SGVector.h>
20 
21 
22 namespace shogun
23 {
24 class CLabels;
25 class CBinaryLabels;
26 class CRegressionLabels;
27 class CKernel;
28 class CCustomKernel;
29 class CFeatures;
30 
51 class CKernelMachine : public CMachine
52 {
53  public:
56 
66 
71 
73  virtual ~CKernelMachine();
74 
80  virtual const char* get_name() const { return "KernelMachine"; }
81 
86  void set_kernel(CKernel* k);
87 
93 
98  void set_batch_computation_enabled(bool enable);
99 
105 
110  void set_linadd_enabled(bool enable);
111 
116  bool get_linadd_enabled();
117 
122  void set_bias_enabled(bool enable_bias);
123 
128  bool get_bias_enabled();
129 
135 
140  void set_bias(float64_t bias);
141 
147  int32_t get_support_vector(int32_t idx);
148 
154  float64_t get_alpha(int32_t idx);
155 
162  bool set_support_vector(int32_t idx, int32_t val);
163 
170  bool set_alpha(int32_t idx, float64_t val);
171 
176  int32_t get_num_support_vectors();
177 
182  void set_alphas(SGVector<float64_t> alphas);
183 
189 
192 
195 
200  bool create_new_model(int32_t num);
201 
207 
214  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL);
215 
222  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);
223 
229  virtual float64_t apply_one(int32_t num);
230 
236  static void* apply_helper(void* p);
237 
244  virtual bool train_locked(SGVector<index_t> indices);
245 
253 
261  SGVector<index_t> indices);
262 
270  SGVector<index_t> indices);
271 
280  virtual void data_lock(CLabels* labs, CFeatures* features=NULL);
281 
283  virtual void data_unlock();
284 
286  virtual bool supports_locking() const;
287 
288  protected:
289 
296 
303  virtual void store_model_features();
304 
305  private:
307  void init();
308 
309  protected:
312 
315 
318 
321 
324 
326  bool use_bias;
327 
330 
333 
336 };
337 }
338 #endif /* _KERNEL_MACHINE_H__ */

SHOGUN Machine Learning Toolbox - Documentation