17 using namespace shogun;
26 int32_t size, int32_t l, int32_t
id, int32_t od)
35 SG_INFO(
"LIK with parms: l=%d, id=%d, od=%d created!\n", l,
id, od);
40 int32_t
id, int32_t od)
49 SG_INFO(
"LIK with parms: l=%d, id=%d, od=%d created!\n", len,
id, od);
68 bool free_avec, free_bvec;
73 ASSERT(alen==blen && alen>0);
79 for (i = 0; i<alen; i++)
80 match[i] = (avec[i] == bvec[i])? 1 : 0;
84 for (t = 0; t<alen-
length; t++)
87 for (i = 0; i<length && t+i+length+1<alen; i++)
88 sum += (i+1)*match[t+i]+(length-i)*match[t+i+length+1];
90 float64_t inner_sum = (sum + (length+1)*match[t+length]) / ((2*length+1)*(length+1));
92 outer_sum += inner_sum;
101 void CLocalityImprovedStringKernel::init()
virtual ~CLocalityImprovedStringKernel()
void add(bool *param, const char *name, const char *description="")
virtual bool init(CFeatures *l, CFeatures *r)
virtual bool init_normalizer()
CFeatures * rhs
feature vectors to occur on right hand side
float64_t compute(int32_t idx_a, int32_t idx_b)
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
CLocalityImprovedStringKernel()
Template class StringKernel, is the base class of all String Kernels.
#define SG_MALLOC(type, len)