SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 1999-2008 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef __GUIKERNEL__H 00013 #define __GUIKERNEL__H 00014 00015 #include <shogun/lib/config.h> 00016 #include <shogun/base/SGObject.h> 00017 #include <shogun/kernel/Kernel.h> 00018 00019 namespace shogun 00020 { 00021 class CSGInterface; 00022 00024 class CGUIKernel : public CSGObject 00025 { 00026 public: 00028 CGUIKernel() { }; 00032 CGUIKernel(CSGInterface* interface); 00033 00035 ~CGUIKernel(); 00036 00038 CKernel* get_kernel(); 00040 bool set_normalization(char* normalization, float64_t c=0.0, float64_t r=0.0); 00042 bool set_kernel(CKernel* kern); 00044 bool add_kernel(CKernel* kern, float64_t weight=1); 00046 bool del_last_kernel(); 00047 00049 bool init_kernel(const char* target); 00051 bool init_kernel_optimization(); 00053 bool delete_kernel_optimization(); 00055 bool save_kernel(char* filename); 00057 bool clean_kernel(); 00058 #ifdef USE_SVMLIGHT 00059 00060 bool resize_kernel_cache(int32_t size); 00061 #endif //USE_SVMLIGHT 00062 00063 bool set_optimization_type(char* opt_type); 00065 bool precompute_subkernels(); 00066 00068 bool is_initialized() { return initialized; } 00069 00071 CKernel* create_oligo(int32_t size, int32_t k, float64_t width); 00073 CKernel* create_diag(int32_t size=10, float64_t diag=1); 00075 CKernel* create_const(int32_t size=10, float64_t c=1); 00077 CKernel* create_custom(float64_t* kmatrix, int32_t num_feat, int32_t num_vec, 00078 bool source_is_diag, bool dest_is_diag); 00080 CKernel* create_gaussianshift( 00081 int32_t size=10, float64_t width=1, int32_t max_shift=0, 00082 int32_t shift_step=1); 00084 CKernel* create_sparsegaussian(int32_t size=10, float64_t width=1); 00086 CKernel* create_gaussian(int32_t size=10, float64_t width=1); 00088 CKernel* create_sigmoid( 00089 int32_t size=10, float64_t gamma=0.01, float64_t coef0=0); 00091 CKernel* create_tppk( 00092 int32_t size, float64_t* km, int32_t rows, int32_t cols); 00094 CKernel* create_sparsepoly( 00095 int32_t size=10, int32_t degree=2, bool inhomogene=false, 00096 bool normalize=true); 00098 CKernel* create_poly( 00099 int32_t size=10, int32_t degree=2, bool inhomogene=false, 00100 bool normalize=true); 00102 CKernel* create_wavelet( 00103 int32_t size=10, float64_t Wdilation=5.0, float64_t Wtranslation=2.0); 00105 CKernel* create_localityimprovedstring( 00106 int32_t size=10, int32_t length=3, int32_t inner_degree=3, 00107 int32_t outer_degree=1, EKernelType ktype=K_LOCALITYIMPROVED); 00109 CKernel* create_weighteddegreestring( 00110 int32_t size=10, int32_t order=3, int32_t max_mismatch=1, 00111 bool use_normalization=true, int32_t mkl_stepsize=1, 00112 bool block_computation=true, int32_t single_degree=-1); 00114 CKernel* create_weighteddegreepositionstring( 00115 int32_t size=10, int32_t order=3, int32_t max_mismatch=1, 00116 int32_t length=0, int32_t center=0, float64_t step=1); 00118 CKernel* create_weighteddegreepositionstring3( 00119 int32_t size=10, int32_t order=3, int32_t max_mismatch=1, 00120 int32_t* shifts=NULL, int32_t length=0, int32_t mkl_stepsize=1, 00121 float64_t* position_weights=NULL); 00123 CKernel* create_weighteddegreepositionstring2( 00124 int32_t size=10, int32_t order=3, int32_t max_mismatch=1, 00125 int32_t* shifts=NULL, int32_t length=0, bool use_normalization=true); 00127 CKernel* create_weighteddegreerbf(int32_t size=10, int32_t degree=1, int32_t nof_properties=1, float64_t width=1); 00129 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); 00131 CKernel* create_localalignmentstring(int32_t size=10); 00133 CKernel* create_fixeddegreestring(int32_t size=10, int32_t d=3); 00135 CKernel* create_chi2(int32_t size=10, float64_t width=1); 00137 CKernel* create_commstring( 00138 int32_t size=10, bool use_sign=false, char* norm_str=NULL, 00139 EKernelType ktype=K_WEIGHTEDCOMMWORDSTRING); 00141 CKernel* create_matchwordstring( 00142 int32_t size=10, int32_t d=3, bool normalize=true); 00144 CKernel* create_polymatchstring( 00145 int32_t size=10, int32_t degree=2, bool inhomogene=false, 00146 bool normalize=true); 00148 CKernel* create_polymatchwordstring( 00149 int32_t size=10, int32_t degree=2, bool inhomogene=false, 00150 bool normalize=true); 00152 CKernel* create_salzbergword(int32_t size=10); 00154 CKernel* create_histogramword(int32_t size=10); 00156 CKernel* create_linearbyte(int32_t size=10, float64_t scale=-1); 00158 CKernel* create_linearword(int32_t size=10, float64_t scale=-1); 00160 CKernel* create_linearstring(int32_t size=10, float64_t scale=-1); 00162 CKernel* create_linear(int32_t size=10, float64_t scale=-1); 00164 CKernel* create_sparselinear(int32_t size=10, float64_t scale=-1); 00166 CKernel* create_distance(int32_t size=10, float64_t width=1); 00168 CKernel* create_combined( 00169 int32_t size=10, bool append_subkernel_weights=false); 00170 00172 virtual const char* get_name() const { return "GUIKernel"; } 00173 00174 protected: 00176 CKernel* kernel; 00178 CSGInterface* ui; 00180 bool initialized; 00181 00182 private: 00183 float64_t* get_weights(int32_t order, int32_t max_mismatch); 00184 }; 00185 } 00186 #endif