Public Member Functions | Protected Member Functions | Protected Attributes

CMatchWordStringKernel Class Reference

Detailed Description

The class MatchWordStringKernel computes a variant of the polynomial kernel on strings of same length converted to a word alphabet.

It is computed as

\[ k({\bf x},{\bf x'})= \sum_{i=0}^L I(x_i=x'_i)+c)^d \]

where I is the indicator function which evaluates to 1 if its argument is true and to 0 otherwise.

Note that additional normalisation is applied, i.e.

\[ k'({\bf x}, {\bf x'})=\frac{k({\bf x}, {\bf x'})}{\sqrt{k({\bf x}, {\bf x})k({\bf x'}, {\bf x'})}} \]

Definition at line 37 of file MatchWordStringKernel.h.

Inheritance diagram for CMatchWordStringKernel:
Inheritance graph

List of all members.

Public Member Functions

 CMatchWordStringKernel ()
 CMatchWordStringKernel (int32_t size, int32_t d)
 CMatchWordStringKernel (CStringFeatures< uint16_t > *l, CStringFeatures< uint16_t > *r, int32_t degree)
virtual ~CMatchWordStringKernel ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual EKernelType get_kernel_type ()
virtual const char * get_name () const

Protected Member Functions

virtual float64_t compute (int32_t idx_a, int32_t idx_b)

Protected Attributes

int32_t degree

Constructor & Destructor Documentation

default constructor

Definition at line 20 of file MatchWordStringKernel.cpp.

CMatchWordStringKernel ( int32_t  size,
int32_t  d 


size cache size
d degree

Definition at line 25 of file MatchWordStringKernel.cpp.

CMatchWordStringKernel ( CStringFeatures< uint16_t > *  l,
CStringFeatures< uint16_t > *  r,
int32_t  degree 


l features of left-hand side
r features of right-hand side
degree degree

Definition at line 32 of file MatchWordStringKernel.cpp.

~CMatchWordStringKernel (  )  [virtual]

Definition at line 41 of file MatchWordStringKernel.cpp.

Member Function Documentation

float64_t compute ( int32_t  idx_a,
int32_t  idx_b 
) [protected, virtual]

compute kernel function for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object

idx_a index a
idx_b index b
computed kernel function at indices a,b

Implements CKernel.

Definition at line 52 of file MatchWordStringKernel.cpp.

virtual EKernelType get_kernel_type (  )  [virtual]

return what type of kernel we are

kernel type LINEAR

Implements CStringKernel< uint16_t >.

Definition at line 72 of file MatchWordStringKernel.h.

virtual const char* get_name ( void   )  const [virtual]

return the kernel's name

name MatchWordString

Reimplemented from CStringKernel< uint16_t >.

Definition at line 78 of file MatchWordStringKernel.h.

bool init ( CFeatures l,
CFeatures r 
) [virtual]

initialize kernel

l features of left-hand side
r features of right-hand side
if initializing was successful

Reimplemented from CStringKernel< uint16_t >.

Definition at line 46 of file MatchWordStringKernel.cpp.

Member Data Documentation

int32_t degree [protected]


Definition at line 96 of file MatchWordStringKernel.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation