The class PolyMatchStringKernel computes a variant of the polynomial kernel on strings of same length.
It is computed as
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.
Definition at line 36 of file PolyMatchStringKernel.h.

Public Member Functions | |
| CPolyMatchStringKernel () | |
| CPolyMatchStringKernel (int32_t size, int32_t degree, bool inhomogene) | |
| CPolyMatchStringKernel (CStringFeatures< char > *l, CStringFeatures< char > *r, int32_t degree, bool inhomogene) | |
| virtual | ~CPolyMatchStringKernel () |
| virtual bool | init (CFeatures *l, CFeatures *r) |
| virtual void | cleanup () |
| virtual EKernelType | get_kernel_type () |
| virtual const char * | get_name () const |
| void | set_rescaling_enabled (bool n) |
| bool | get_rescaling_enabled () |
Protected Member Functions | |
| virtual float64_t | compute (int32_t idx_a, int32_t idx_b) |
Protected Attributes | |
| int32_t | degree |
| bool | inhomogene |
| bool | rescaling |
| CPolyMatchStringKernel | ( | void | ) |
default constructor
Definition at line 20 of file PolyMatchStringKernel.cpp.
| CPolyMatchStringKernel | ( | int32_t | size, | |
| int32_t | degree, | |||
| bool | inhomogene | |||
| ) |
constructor
| size | cache size | |
| degree | degree | |
| inhomogene | is inhomogeneous |
Definition at line 26 of file PolyMatchStringKernel.cpp.
| CPolyMatchStringKernel | ( | CStringFeatures< char > * | l, | |
| CStringFeatures< char > * | r, | |||
| int32_t | degree, | |||
| bool | inhomogene | |||
| ) |
constructor
| l | features of left-hand side | |
| r | features of right-hand side | |
| degree | degree | |
| inhomogene | is inhomogeneous |
Definition at line 35 of file PolyMatchStringKernel.cpp.
| ~CPolyMatchStringKernel | ( | ) | [virtual] |
Definition at line 47 of file PolyMatchStringKernel.cpp.
| void cleanup | ( | ) | [virtual] |
clean up kernel
Reimplemented from CKernel.
Definition at line 58 of file PolyMatchStringKernel.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 |
Implements CKernel.
Definition at line 63 of file PolyMatchStringKernel.cpp.
| virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Implements CStringKernel< char >.
Definition at line 78 of file PolyMatchStringKernel.h.
| virtual const char* get_name | ( | void | ) | const [virtual] |
return the kernel's name
Reimplemented from CStringKernel< char >.
Definition at line 87 of file PolyMatchStringKernel.h.
| bool get_rescaling_enabled | ( | ) |
return rescaling parameter
Definition at line 102 of file PolyMatchStringKernel.h.
initialize kernel
| l | features of left-hand side | |
| r | features of right-hand side |
Reimplemented from CStringKernel< char >.
Definition at line 52 of file PolyMatchStringKernel.cpp.
| void set_rescaling_enabled | ( | bool | n | ) |
enable rescaling by length of feature vector
| n | true to enable |
Definition at line 93 of file PolyMatchStringKernel.h.
int32_t degree [protected] |
degree
Definition at line 123 of file PolyMatchStringKernel.h.
bool inhomogene [protected] |
if kernel is inhomogeneous
Definition at line 125 of file PolyMatchStringKernel.h.
bool rescaling [protected] |
true to rescale kernel with string length
Definition at line 127 of file PolyMatchStringKernel.h.