Public Member Functions | Protected Member Functions | Protected Attributes

CSNPStringKernel Class Reference


Detailed Description

The class SNPStringKernel computes a variant of the polynomial kernel on strings of same length.

It is computed as FIXME

\[ k({\bf x},{\bf x'})= (\sum_{i=0}^{L-1} 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 36 of file SNPStringKernel.h.

Inheritance diagram for CSNPStringKernel:
Inheritance graph
[legend]

List of all members.

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
virtual void register_params ()

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

Constructor & Destructor Documentation

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

Parameters:
size cache size
degree degree
win_len length of local window
inhomogene whether inhomogeneous poly

Definition at line 29 of file SNPStringKernel.cpp.

CSNPStringKernel ( CStringFeatures< char > *  l,
CStringFeatures< char > *  r,
int32_t  degree,
int32_t  win_len,
bool  inhomogene 
)

constructor

Parameters:
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 39 of file SNPStringKernel.cpp.

~CSNPStringKernel (  )  [virtual]

Definition at line 53 of file SNPStringKernel.cpp.


Member Function Documentation

void cleanup (  )  [virtual]

clean up kernel

Reimplemented from CKernel.

Definition at line 64 of file SNPStringKernel.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

Parameters:
idx_a index a
idx_b index b
Returns:
computed kernel function at indices a,b

Implements CKernel.

Definition at line 123 of file SNPStringKernel.cpp.

virtual EKernelType get_kernel_type (  )  [virtual]

return what type of kernel we are

Returns:
kernel type POLYMATCH

Implements CStringKernel< char >.

Definition at line 80 of file SNPStringKernel.h.

char* get_major_base_string (  ) 

get the base string for major aleles

Returns:
major freq. string

Definition at line 116 of file SNPStringKernel.h.

char* get_minor_base_string (  ) 

get the base string for minor aleles

Returns:
minor freq. string

Definition at line 107 of file SNPStringKernel.h.

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

return the kernel's name

Returns:
name PolyMatchString

Reimplemented from CStringKernel< char >.

Definition at line 128 of file SNPStringKernel.h.

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

initialize kernel

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

Reimplemented from CStringKernel< char >.

Definition at line 58 of file SNPStringKernel.cpp.

void obtain_base_strings (  ) 

compute the minor / major alele base strings

Definition at line 71 of file SNPStringKernel.cpp.

void register_params (  )  [virtual]

Separate the function of parameter registration This can be the first stage of a *general* framework for cross-validation or other parameter-based operations

Reimplemented from CKernel.

Definition at line 181 of file SNPStringKernel.cpp.

void set_major_base_string ( const char *  str  ) 

set the base string for major aleles

Parameters:
str major freq. string

Definition at line 98 of file SNPStringKernel.h.

void set_minor_base_string ( const char *  str  ) 

set the base string for minor aleles

Parameters:
str minor freq. string

Definition at line 89 of file SNPStringKernel.h.


Member Data Documentation

int32_t m_degree [protected]

degree

Definition at line 147 of file SNPStringKernel.h.

bool m_inhomogene [protected]

inhomogeneous poly kernel ?

Definition at line 152 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 156 of file SNPStringKernel.h.

char* m_str_maj [protected]

allele B

Definition at line 161 of file SNPStringKernel.h.

char* m_str_min [protected]

allele A

Definition at line 159 of file SNPStringKernel.h.

int32_t m_win_len [protected]

window length

Definition at line 149 of file SNPStringKernel.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