Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef DISTANTSEGMENTSKERNEL_H_
00013 #define DISTANTSEGMENTSKERNEL_H_
00014
00015 #include <shogun/kernel/StringKernel.h>
00016
00017 namespace shogun
00018 {
00019
00034 class CDistantSegmentsKernel: public CStringKernel<char>
00035 {
00036 public:
00038 CDistantSegmentsKernel(void);
00039
00046 CDistantSegmentsKernel(int32_t size, int32_t delta, int32_t theta);
00047
00056 CDistantSegmentsKernel(CStringFeatures<char>* l, CStringFeatures<char>* r,
00057 int32_t size, int32_t delta, int32_t theta);
00058
00065 virtual bool init(CFeatures* l, CFeatures* r);
00066
00070 virtual EKernelType get_kernel_type()
00071 {
00072 return K_DISTANTSEGMENTS;
00073 }
00074
00078 virtual const char* get_name() const
00079 {
00080 return "DistantSegmentsKernel";
00081 }
00082
00083 protected:
00093 virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00094
00095 private:
00097 void init();
00098
00103 int32_t bin(int32_t j, int32_t i);
00104
00118 int32_t compute(char* s, int32_t sLength, char* b, int32_t bLength,
00119 int32_t delta_m, int32_t theta_m);
00120
00121 protected:
00123 int32_t m_delta;
00124
00126 int32_t m_theta;
00127
00128
00129 };
00130
00131 }
00132
00133 #endif