SHOGUN v0.9.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 Gunnar Raetsch 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___ 00012 #define _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___ 00013 00014 #include "lib/common.h" 00015 #include "kernel/StringKernel.h" 00016 00017 namespace shogun 00018 { 00030 class CSimpleLocalityImprovedStringKernel: public CStringKernel<char> 00031 { 00032 public: 00034 CSimpleLocalityImprovedStringKernel(); 00035 00043 CSimpleLocalityImprovedStringKernel(int32_t size, int32_t length, 00044 int32_t inner_degree, int32_t outer_degree); 00045 00054 CSimpleLocalityImprovedStringKernel( 00055 CStringFeatures<char>* l, CStringFeatures<char>* r, 00056 int32_t length, int32_t inner_degree, int32_t outer_degree); 00057 00058 virtual ~CSimpleLocalityImprovedStringKernel(); 00059 00066 virtual bool init(CFeatures *l, CFeatures *r); 00067 00069 virtual void cleanup(); 00070 00075 virtual EKernelType get_kernel_type() 00076 { 00077 return K_SIMPLELOCALITYIMPROVED; 00078 } 00079 00084 virtual const char* get_name() const { return "SimpleLocalityImproved"; } 00085 00086 private: 00098 float64_t dot_pyr (const char* const x1, const char* const x2, 00099 const int32_t NOF_NTS, const int32_t NTWIDTH, 00100 const int32_t DEGREE1, const int32_t DEGREE2, float64_t *pyra); 00101 00102 protected: 00111 float64_t compute(int32_t idx_a, int32_t idx_b); 00112 00113 private: 00114 void init(); 00115 00116 protected: 00118 int32_t length; 00120 int32_t inner_degree; 00122 int32_t outer_degree; 00123 00125 float64_t *pyramid_weights; 00127 int32_t num_pyramid_weights; 00128 }; 00129 } 00130 #endif /* _SIMPLELOCALITYIMPROVEDSTRINGKERNEL_H___ */