The class SNPStringKernel computes a variant of the polynomial kernel on strings of same length.
It is computed as FIXME
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 SNPStringKernel.h.
Public Member Functions | |
CSNPStringKernel (void) | |
CSNPStringKernel (int32_t size, int32_t degree, int32_t win_len, bool inhomogene) | |
CSNPStringKernel (CStringFeatures< char > *l, CStringFeatures< char > *r, int32_t degree, int32_t win_len, bool inhomogene) | |
virtual | ~CSNPStringKernel () |
virtual bool | init (CFeatures *l, CFeatures *r) |
virtual void | cleanup () |
virtual EKernelType | get_kernel_type () |
void | set_minor_base_string (const char *str) |
void | set_major_base_string (const char *str) |
char * | get_minor_base_string () |
char * | get_major_base_string () |
void | obtain_base_strings () |
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 | m_degree |
int32_t | m_win_len |
bool | m_inhomogene |
int32_t | m_str_len |
char * | m_str_min |
char * | m_str_maj |
CSNPStringKernel | ( | void | ) |
default constructor
Definition at line 20 of file SNPStringKernel.cpp.
CSNPStringKernel | ( | int32_t | size, | |
int32_t | degree, | |||
int32_t | win_len, | |||
bool | inhomogene | |||
) |
constructor
size | cache size | |
degree | degree | |
win_len | length of local window | |
inhomogene | whether inhomogeneous poly |
Definition at line 31 of file SNPStringKernel.cpp.
CSNPStringKernel | ( | CStringFeatures< char > * | l, | |
CStringFeatures< char > * | r, | |||
int32_t | degree, | |||
int32_t | win_len, | |||
bool | inhomogene | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side | |
degree | degree | |
win_len | length of local window | |
inhomogene | whether inhomogeneous poly |
Definition at line 41 of file SNPStringKernel.cpp.
~CSNPStringKernel | ( | ) | [virtual] |
Definition at line 55 of file SNPStringKernel.cpp.
void cleanup | ( | ) | [virtual] |
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 128 of file SNPStringKernel.cpp.
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Implements CStringKernel< char >.
Definition at line 80 of file SNPStringKernel.h.
char* get_major_base_string | ( | ) |
Definition at line 100 of file SNPStringKernel.h.
char* get_minor_base_string | ( | ) |
Definition at line 95 of file SNPStringKernel.h.
virtual const char* get_name | ( | void | ) | const [virtual] |
return the kernel's name
Reimplemented from CStringKernel< char >.
Definition at line 111 of file SNPStringKernel.h.
initialize kernel
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CStringKernel< char >.
Definition at line 60 of file SNPStringKernel.cpp.
void obtain_base_strings | ( | ) |
Definition at line 73 of file SNPStringKernel.cpp.
void set_major_base_string | ( | const char * | str | ) |
Definition at line 90 of file SNPStringKernel.h.
void set_minor_base_string | ( | const char * | str | ) |
Definition at line 85 of file SNPStringKernel.h.
int32_t m_degree [protected] |
degree
Definition at line 126 of file SNPStringKernel.h.
bool m_inhomogene [protected] |
inhomogeneous poly kernel ?
Definition at line 131 of file SNPStringKernel.h.
int32_t m_str_len [protected] |
total string length / must match length of min/maj strings and string length of each vector
Definition at line 135 of file SNPStringKernel.h.
char* m_str_maj [protected] |
allele B
Definition at line 140 of file SNPStringKernel.h.
char* m_str_min [protected] |
allele A
Definition at line 138 of file SNPStringKernel.h.
int32_t m_win_len [protected] |
window length
Definition at line 128 of file SNPStringKernel.h.