SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GUIKernel.h
Go to the documentation of this file.
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 
00060     bool set_optimization_type(char* opt_type);
00062     bool precompute_subkernels();
00063 
00065     bool is_initialized() { return initialized; }
00066 
00068     CKernel* create_oligo(int32_t size, int32_t k, float64_t width);
00070     CKernel* create_diag(int32_t size=10, float64_t diag=1);
00072     CKernel* create_const(int32_t size=10, float64_t c=1);
00074     CKernel* create_custom(float64_t* kmatrix, int32_t num_feat, int32_t num_vec,
00075         bool source_is_diag, bool dest_is_diag);
00077     CKernel* create_gaussianshift(
00078         int32_t size=10, float64_t width=1, int32_t max_shift=0,
00079         int32_t shift_step=1);
00081     CKernel* create_sparsegaussian(int32_t size=10, float64_t width=1);
00083     CKernel* create_gaussian(int32_t size=10, float64_t width=1);
00085     CKernel* create_sigmoid(
00086         int32_t size=10, float64_t gamma=0.01, float64_t coef0=0);
00088     CKernel* create_tppk(
00089         int32_t size, float64_t* km, int32_t rows, int32_t cols);
00091     CKernel* create_sparsepoly(
00092         int32_t size=10, int32_t degree=2, bool inhomogene=false,
00093         bool normalize=true);
00095     CKernel* create_poly(
00096         int32_t size=10, int32_t degree=2, bool inhomogene=false,
00097         bool normalize=true);
00099     CKernel* create_wavelet(
00100         int32_t size=10, float64_t Wdilation=5.0, float64_t Wtranslation=2.0);
00102     CKernel* create_localityimprovedstring(
00103         int32_t size=10, int32_t length=3, int32_t inner_degree=3,
00104         int32_t outer_degree=1, EKernelType ktype=K_LOCALITYIMPROVED);
00106     CKernel* create_weighteddegreestring(
00107         int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
00108         bool use_normalization=true, int32_t mkl_stepsize=1,
00109         bool block_computation=true, int32_t single_degree=-1);
00111     CKernel* create_weighteddegreepositionstring(
00112         int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
00113         int32_t length=0, int32_t center=0, float64_t step=1);
00115     CKernel* create_weighteddegreepositionstring3(
00116         int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
00117         int32_t* shifts=NULL, int32_t length=0, int32_t mkl_stepsize=1,
00118         float64_t* position_weights=NULL);
00120     CKernel* create_weighteddegreepositionstring2(
00121         int32_t size=10, int32_t order=3, int32_t max_mismatch=1,
00122         int32_t* shifts=NULL, int32_t length=0, bool use_normalization=true);
00124     CKernel* create_weighteddegreerbf(int32_t size=10, int32_t degree=1, int32_t nof_properties=1, float64_t width=1);
00126     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);
00128     CKernel* create_localalignmentstring(int32_t size=10);
00130     CKernel* create_fixeddegreestring(int32_t size=10, int32_t d=3);
00132     CKernel* create_chi2(int32_t size=10, float64_t width=1);
00134     CKernel* create_commstring(
00135         int32_t size=10, bool use_sign=false, char* norm_str=NULL,
00136         EKernelType ktype=K_WEIGHTEDCOMMWORDSTRING);
00138     CKernel* create_matchwordstring(
00139         int32_t size=10, int32_t d=3, bool normalize=true);
00141     CKernel* create_polymatchstring(
00142         int32_t size=10, int32_t degree=2, bool inhomogene=false,
00143         bool normalize=true);
00145     CKernel* create_polymatchwordstring(
00146         int32_t size=10, int32_t degree=2, bool inhomogene=false,
00147         bool normalize=true);
00149     CKernel* create_salzbergword(int32_t size=10);
00151     CKernel* create_histogramword(int32_t size=10);
00153     CKernel* create_linearbyte(int32_t size=10, float64_t scale=-1);
00155     CKernel* create_linearword(int32_t size=10, float64_t scale=-1);
00157     CKernel* create_linearstring(int32_t size=10, float64_t scale=-1);
00159     CKernel* create_linear(int32_t size=10, float64_t scale=-1);
00161     CKernel* create_sparselinear(int32_t size=10, float64_t scale=-1);
00163     CKernel* create_distance(int32_t size=10, float64_t width=1);
00165     CKernel* create_combined(
00166         int32_t size=10, bool append_subkernel_weights=false);
00167 
00169     inline virtual const char* get_name() const { return "GUIKernel"; }
00170 
00171  protected:
00173     CKernel* kernel;
00175     CSGInterface* ui;
00177     bool initialized;
00178 
00179  private:
00180     float64_t* get_weights(int32_t order, int32_t max_mismatch);
00181 };
00182 }
00183 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation