18 m_delta(0), m_theta(0)
44 void CDistantSegmentsKernel::init()
53 int32_t aLength=0, bLength=0;
60 if ((aLength<1)||(bLength<1))
71 int32_t CDistantSegmentsKernel::bin(int32_t j, int32_t i)
77 return j*(j-1)*(j-2)/6;
79 else if (i==2 && j>=2)
87 int32_t tLength, int32_t delta_m, int32_t theta_m)
90 int32_t* i_=SG_MALLOC(int32_t, delta_m+1);
91 int32_t* l_=SG_MALLOC(int32_t, delta_m+1);
92 for (int32_t j_s=0; j_s<=(int32_t) sLength-1; j_s++)
94 for (int32_t j_t=0; j_t<=(int32_t) tLength-1; j_t++)
96 if (s[j_s-1+1]==t[j_t-1+1])
106 while (i<=n&&s[j_s-1+i]==t[j_t-1+i])
109 l_[k]=i_[2*k+1]-i_[2*k]+1;
111 while (i<=n&&s[j_s-1+i]!=t[j_t-1+i])
114 c+=bin(l_[0], 3)-2*bin(l_[0]-theta_m, 3)
115 +bin(l_[0]-2*theta_m, 3);
117 for (int32_t r=1; r<=k; r++)
119 c1+=bin(l_[r], 2)-bin(l_[r]-theta_m, 2);
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual bool init_normalizer()
CFeatures * rhs
feature vectors to occur on right hand side
all of classes and functions are contained in the shogun namespace
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
Template class StringKernel, is the base class of all String Kernels.
virtual bool init(CFeatures *l, CFeatures *r)