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 #include <stdio.h>
22 
23 namespace shogun
24 {
25 class CLabels;
26 class CBinaryLabels;
27 class CRegressionLabels;
28 class CKernel;
29 class CCustomKernel;
30 class CFeatures;
31 
52 class CKernelMachine : public CMachine
53 {
54  public:
57 
67 
72 
74  virtual ~CKernelMachine();
75 
81  virtual const char* get_name() const { return "KernelMachine"; }
82 
87  void set_kernel(CKernel* k);
88 
94 
99  void set_batch_computation_enabled(bool enable);
100 
106 
111  void set_linadd_enabled(bool enable);
112 
117  bool get_linadd_enabled();
118 
123  void set_bias_enabled(bool enable_bias);
124 
129  bool get_bias_enabled();
130 
136 
141  void set_bias(float64_t bias);
142 
148  int32_t get_support_vector(int32_t idx);
149 
155  float64_t get_alpha(int32_t idx);
156 
163  bool set_support_vector(int32_t idx, int32_t val);
164 
171  bool set_alpha(int32_t idx, float64_t val);
172 
177  int32_t get_num_support_vectors();
178 
183  void set_alphas(SGVector<float64_t> alphas);
184 
190 
193 
196 
201  bool create_new_model(int32_t num);
202 
208 
215  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL);
216 
223  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);
224 
230  virtual float64_t apply_one(int32_t num);
231 
237  static void* apply_helper(void* p);
238 
245  virtual bool train_locked(SGVector<index_t> indices);
246 
254 
262  SGVector<index_t> indices);
263 
271  SGVector<index_t> indices);
272 
281  virtual void data_lock(CLabels* labs, CFeatures* features=NULL);
282 
284  virtual void data_unlock();
285 
287  virtual bool supports_locking() const;
288 
289  protected:
290 
297 
304  virtual void store_model_features();
305 
306  private:
308  void init();
309 
310  protected:
313 
316 
319 
322 
325 
327  bool use_bias;
328 
331 
334 
337 };
338 }
339 #endif /* _KERNEL_MACHINE_H__ */

SHOGUN Machine Learning Toolbox - Documentation