SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIKernel.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-2008 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef __GUIKERNEL__H
13 #define __GUIKERNEL__H
14 
15 #include <shogun/lib/config.h>
16 #include <shogun/base/SGObject.h>
17 #include <shogun/kernel/Kernel.h>
18 
19 namespace shogun
20 {
21 class CSGInterface;
22 
24 class CGUIKernel : public CSGObject
25 {
26  public:
28  CGUIKernel() { };
32  CGUIKernel(CSGInterface* interface);
33 
35  ~CGUIKernel();
36 
40  bool set_normalization(char* normalization, float64_t c=0.0, float64_t r=0.0);
42  bool set_kernel(CKernel* kern);
44  bool add_kernel(CKernel* kern, float64_t weight=1);
46  bool del_last_kernel();
47 
49  bool init_kernel(const char* target);
55  bool save_kernel(char* filename);
57  bool clean_kernel();
58 #ifdef USE_SVMLIGHT
59 
60  bool resize_kernel_cache(int32_t size);
61 #endif //USE_SVMLIGHT
62 
63  bool set_optimization_type(char* opt_type);
65  bool precompute_subkernels();
66 
68  bool is_initialized() { return initialized; }
69 
71  CKernel* create_oligo(int32_t size, int32_t k, float64_t width);
73  CKernel* create_diag(int32_t size=10, float64_t diag=1);
75  CKernel* create_const(int32_t size=10, float64_t c=1);
77  CKernel* create_custom(float64_t* kmatrix, int32_t num_feat, int32_t num_vec,
78  bool source_is_diag, bool dest_is_diag);
81  int32_t size=10, float64_t width=1, int32_t max_shift=0,
82  int32_t shift_step=1);
84  CKernel* create_sparsegaussian(int32_t size=10, float64_t width=1);
86  CKernel* create_gaussian(int32_t size=10, float64_t width=1);
89  int32_t size=10, float64_t gamma=0.01, float64_t coef0=0);
92  int32_t size, float64_t* km, int32_t rows, int32_t cols);
95  int32_t size=10, int32_t degree=2, bool inhomogene=false,
96  bool normalize=true);
99  int32_t size=10, int32_t degree=2, bool inhomogene=false,
100  bool normalize=true);
103  int32_t size=10, float64_t Wdilation=5.0, float64_t Wtranslation=2.0);
106  int32_t size=10, int32_t length=3, int32_t inner_degree=3,
107  int32_t outer_degree=1, EKernelType ktype=K_LOCALITYIMPROVED);
110  int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
111  bool use_normalization=true, int32_t mkl_stepsize=1,
112  bool block_computation=true, int32_t single_degree=-1);
115  int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
116  int32_t length=0, int32_t center=0, float64_t step=1);
119  int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
120  int32_t* shifts=NULL, int32_t length=0, int32_t mkl_stepsize=1,
121  float64_t* position_weights=NULL);
124  int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
125  int32_t* shifts=NULL, int32_t length=0, bool use_normalization=true);
127  CKernel* create_weighteddegreerbf(int32_t size=10, int32_t degree=1, int32_t nof_properties=1, float64_t width=1);
129  CKernel* create_spectrummismatchrbf(int32_t size=10, float64_t* AA_matrix = NULL, int32_t nr=128, int32_t nc=128, int32_t max_mismatch=1, int32_t degree=1, float64_t width=1);
131  CKernel* create_localalignmentstring(int32_t size=10);
133  CKernel* create_fixeddegreestring(int32_t size=10, int32_t d=3);
135  CKernel* create_chi2(int32_t size=10, float64_t width=1);
138  int32_t size=10, bool use_sign=false, char* norm_str=NULL,
142  int32_t size=10, int32_t d=3, bool normalize=true);
145  int32_t size=10, int32_t degree=2, bool inhomogene=false,
146  bool normalize=true);
149  int32_t size=10, int32_t degree=2, bool inhomogene=false,
150  bool normalize=true);
152  CKernel* create_salzbergword(int32_t size=10);
154  CKernel* create_histogramword(int32_t size=10);
156  CKernel* create_linearbyte(int32_t size=10, float64_t scale=-1);
158  CKernel* create_linearword(int32_t size=10, float64_t scale=-1);
160  CKernel* create_linearstring(int32_t size=10, float64_t scale=-1);
162  CKernel* create_linear(int32_t size=10, float64_t scale=-1);
164  CKernel* create_sparselinear(int32_t size=10, float64_t scale=-1);
166  CKernel* create_distance(int32_t size=10, float64_t width=1);
169  int32_t size=10, bool append_subkernel_weights=false);
170 
172  virtual const char* get_name() const { return "GUIKernel"; }
173 
174  protected:
178  CSGInterface* ui;
181 
182  private:
183  float64_t* get_weights(int32_t order, int32_t max_mismatch);
184 };
185 }
186 #endif

SHOGUN Machine Learning Toolbox - Documentation