Public Member Functions | Protected Member Functions | Protected Attributes

CFixedDegreeStringKernel Class Reference

Detailed Description

The FixedDegree String kernel takes as input two strings of same size and counts the number of matches of length d.

\[ k({\bf x}, {\bf x'}) = \sum_{i=0}^{l-d} I({\bf x}_{i,i+1,\dots,i+d-1} = {\bf x'}_{i,i+1,\dots,i+d-1}) \]

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 31 of file FixedDegreeStringKernel.h.

Inheritance diagram for CFixedDegreeStringKernel:
Inheritance graph

List of all members.

Public Member Functions

 CFixedDegreeStringKernel ()
 CFixedDegreeStringKernel (int32_t size, int32_t degree)
 CFixedDegreeStringKernel (CStringFeatures< char > *l, CStringFeatures< char > *r, int32_t degree)
virtual ~CFixedDegreeStringKernel ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual EKernelType get_kernel_type ()
virtual const char * get_name () const

Protected Member Functions

float64_t compute (int32_t idx_a, int32_t idx_b)

Protected Attributes

int32_t degree

Constructor & Destructor Documentation

default constructor

Definition at line 27 of file FixedDegreeStringKernel.cpp.

CFixedDegreeStringKernel ( int32_t  size,
int32_t  degree 


size cache size
degree the degree

Definition at line 33 of file FixedDegreeStringKernel.cpp.

CFixedDegreeStringKernel ( CStringFeatures< char > *  l,
CStringFeatures< char > *  r,
int32_t  degree 


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

Definition at line 39 of file FixedDegreeStringKernel.cpp.

~CFixedDegreeStringKernel (  )  [virtual]

Definition at line 47 of file FixedDegreeStringKernel.cpp.

Member Function Documentation

void cleanup (  )  [virtual]

clean up kernel

Reimplemented from CKernel.

Definition at line 58 of file FixedDegreeStringKernel.cpp.

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 63 of file FixedDegreeStringKernel.cpp.

virtual EKernelType get_kernel_type (  )  [virtual]

return what type of kernel we are

kernel type FIXEDDEGREE

Implements CStringKernel< char >.

Definition at line 73 of file FixedDegreeStringKernel.h.

virtual const char* get_name (  )  const [virtual]

return the kernel's name

name FixedDegree

Reimplemented from CStringKernel< char >.

Definition at line 82 of file FixedDegreeStringKernel.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< char >.

Definition at line 52 of file FixedDegreeStringKernel.cpp.

Member Data Documentation

int32_t degree [protected]

the degree

Definition at line 95 of file FixedDegreeStringKernel.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