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) 2014 Soumyajit De 00008 */ 00009 00010 #ifndef STRING_SUBSEQUENCE_KERNEL_H_ 00011 #define STRING_SUBSEQUENCE_KERNEL_H_ 00012 00013 #include <shogun/lib/common.h> 00014 #include <shogun/kernel/string/StringKernel.h> 00015 00016 namespace shogun 00017 { 00053 class CStringSubsequenceKernel: public CStringKernel<char> 00054 { 00055 public: 00057 CStringSubsequenceKernel(); 00058 00066 CStringSubsequenceKernel(int32_t size, int32_t maxlen, float64_t lambda); 00067 00076 CStringSubsequenceKernel(CStringFeatures<char>* lhs, CStringFeatures<char>* rhs, 00077 int32_t maxlen, float64_t lambda); 00078 00080 virtual ~CStringSubsequenceKernel(); 00081 00089 virtual bool init(CFeatures* lhs, CFeatures* rhs); 00090 00092 virtual void cleanup(); 00093 00095 virtual EKernelType get_kernel_type() 00096 { 00097 return K_POLYMATCH; 00098 } 00099 00101 virtual const char* get_name() const 00102 { 00103 return "StringSubsequenceKernel"; 00104 } 00105 00107 virtual void register_params(); 00108 00131 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00132 00133 protected: 00135 int32_t m_maxlen; 00136 00138 float64_t m_lambda; 00139 }; 00140 00141 } 00142 #endif // STRING_SUBSEQUENCE_KERNEL_H_