SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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
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)
Definition: GUIKernel.cpp:390
CKernel * create_linear(int32_t size=10, float64_t scale=-1)
Definition: GUIKernel.cpp:578
CKernel * create_weighteddegreepositionstring(int32_t size=10, int32_t order=3, int32_t max_mismatch=1, int32_t length=0, int32_t center=0, float64_t step=1)
Definition: GUIKernel.cpp:276
CKernel * create_sparsepoly(int32_t size=10, int32_t degree=2, bool inhomogene=false, bool normalize=true)
Definition: GUIKernel.cpp:190
bool resize_kernel_cache(int32_t size)
Definition: GUIKernel.cpp:922
CKernel * create_histogramword(int32_t size=10)
Definition: GUIKernel.cpp:530
CSGInterface * interface
Definition: SGInterface.cpp:45
UI kernel.
Definition: GUIKernel.h:24
EKernelType
Definition: Kernel.h:57
CKernel * create_commstring(int32_t size=10, bool use_sign=false, char *norm_str=NULL, EKernelType ktype=K_WEIGHTEDCOMMWORDSTRING)
Definition: GUIKernel.cpp:437
CKernel * create_polymatchwordstring(int32_t size=10, int32_t degree=2, bool inhomogene=false, bool normalize=true)
Definition: GUIKernel.cpp:491
CKernel * create_sparselinear(int32_t size=10, float64_t scale=-1)
Definition: GUIKernel.cpp:589
CKernel * create_fixeddegreestring(int32_t size=10, int32_t d=3)
Definition: GUIKernel.cpp:415
CKernel * create_linearstring(int32_t size=10, float64_t scale=-1)
Definition: GUIKernel.cpp:566
CKernel * create_localityimprovedstring(int32_t size=10, int32_t length=3, int32_t inner_degree=3, int32_t outer_degree=1, EKernelType ktype=K_LOCALITYIMPROVED)
Definition: GUIKernel.cpp:212
CKernel * create_linearword(int32_t size=10, float64_t scale=-1)
Definition: GUIKernel.cpp:556
CKernel * create_weighteddegreepositionstring2(int32_t size=10, int32_t order=3, int32_t max_mismatch=1, int32_t *shifts=NULL, int32_t length=0, bool use_normalization=true)
Definition: GUIKernel.cpp:332
CKernel * create_gaussianshift(int32_t size=10, float64_t width=1, int32_t max_shift=0, int32_t shift_step=1)
Definition: GUIKernel.cpp:134
bool init_kernel(const char *target)
Definition: GUIKernel.cpp:757
CSGInterface * ui
Definition: GUIKernel.h:178
CKernel * create_linearbyte(int32_t size=10, float64_t scale=-1)
Definition: GUIKernel.cpp:546
CKernel * create_combined(int32_t size=10, bool append_subkernel_weights=false)
Definition: GUIKernel.cpp:627
CKernel * create_custom(float64_t *kmatrix, int32_t num_feat, int32_t num_vec, bool source_is_diag, bool dest_is_diag)
Definition: GUIKernel.cpp:113
bool save_kernel(char *filename)
Definition: GUIKernel.cpp:837
CKernel * create_localalignmentstring(int32_t size=10)
Definition: GUIKernel.cpp:404
CKernel * create_salzbergword(int32_t size=10)
Definition: GUIKernel.cpp:502
bool set_optimization_type(char *opt_type)
Definition: GUIKernel.cpp:932
CKernel * kernel
Definition: GUIKernel.h:176
CKernel * create_weighteddegreepositionstring3(int32_t size=10, int32_t order=3, int32_t max_mismatch=1, int32_t *shifts=NULL, int32_t length=0, int32_t mkl_stepsize=1, float64_t *position_weights=NULL)
Definition: GUIKernel.cpp:309
CKernel * create_weighteddegreerbf(int32_t size=10, int32_t degree=1, int32_t nof_properties=1, float64_t width=1)
Definition: GUIKernel.cpp:379
CKernel * create_const(int32_t size=10, float64_t c=1)
Definition: GUIKernel.cpp:100
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:115
CKernel * create_weighteddegreestring(int32_t size=10, int32_t order=3, int32_t max_mismatch=1, bool use_normalization=true, int32_t mkl_stepsize=1, bool block_computation=true, int32_t single_degree=-1)
Definition: GUIKernel.cpp:237
CKernel * create_sigmoid(int32_t size=10, float64_t gamma=0.01, float64_t coef0=0)
Definition: GUIKernel.cpp:168
double float64_t
Definition: common.h:50
CKernel * create_poly(int32_t size=10, int32_t degree=2, bool inhomogene=false, bool normalize=true)
Definition: GUIKernel.cpp:201
CKernel * create_diag(int32_t size=10, float64_t diag=1)
Definition: GUIKernel.cpp:89
CKernel * get_kernel()
Definition: GUIKernel.cpp:76
CKernel * create_chi2(int32_t size=10, float64_t width=1)
Definition: GUIKernel.cpp:426
bool delete_kernel_optimization()
Definition: GUIKernel.cpp:748
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
CKernel * create_matchwordstring(int32_t size=10, int32_t d=3, bool normalize=true)
Definition: GUIKernel.cpp:469
void scale(Matrix A, Matrix B, typename Matrix::Scalar alpha)
Definition: Core.h:94
CKernel * create_wavelet(int32_t size=10, float64_t Wdilation=5.0, float64_t Wtranslation=2.0)
Definition: GUIKernel.cpp:179
bool is_initialized()
Definition: GUIKernel.h:68
bool precompute_subkernels()
Definition: GUIKernel.cpp:960
The Kernel base class.
Definition: Kernel.h:159
CKernel * create_gaussian(int32_t size=10, float64_t width=1)
Definition: GUIKernel.cpp:157
CKernel * create_oligo(int32_t size, int32_t k, float64_t width)
Definition: GUIKernel.cpp:81
CKernel * create_tppk(int32_t size, float64_t *km, int32_t rows, int32_t cols)
Definition: GUIKernel.cpp:600
bool init_kernel_optimization()
Definition: GUIKernel.cpp:715
bool set_kernel(CKernel *kern)
Definition: GUIKernel.cpp:699
CKernel * create_distance(int32_t size=10, float64_t width=1)
Definition: GUIKernel.cpp:612
virtual const char * get_name() const
Definition: GUIKernel.h:172
CKernel * create_polymatchstring(int32_t size=10, int32_t degree=2, bool inhomogene=false, bool normalize=true)
Definition: GUIKernel.cpp:480
bool add_kernel(CKernel *kern, float64_t weight=1)
Definition: GUIKernel.cpp:861
CKernel * create_sparsegaussian(int32_t size=10, float64_t width=1)
Definition: GUIKernel.cpp:146
bool set_normalization(char *normalization, float64_t c=0.0, float64_t r=0.0)
Definition: GUIKernel.cpp:639

SHOGUN Machine Learning Toolbox - Documentation