The Weighted Degree String kernel.
The WD kernel of order d compares two sequences and
of length L by summing all contributions of k-mer matches of lengths
, weighted by coefficients
. It is defined as
Here, is the string of length k starting at position l of the sequence
and
is the indicator function which evaluates to 1 when its argument is true and to 0 otherwise.
Definition at line 52 of file WeightedDegreeStringKernel.h.
CWeightedDegreeStringKernel | ( | int32_t | degree, | |
EWDKernType | type = E_WD | |||
) |
constructor
degree | degree | |
type | weighted degree kernel type |
Definition at line 54 of file WeightedDegreeStringKernel.cpp.
CWeightedDegreeStringKernel | ( | float64_t * | weights, | |
int32_t | degree | |||
) |
constructor
weights | kernel's weights | |
degree | degree |
Definition at line 73 of file WeightedDegreeStringKernel.cpp.
CWeightedDegreeStringKernel | ( | CStringFeatures< char > * | l, | |
CStringFeatures< char > * | r, | |||
int32_t | degree | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side | |
degree | degree |
Definition at line 92 of file WeightedDegreeStringKernel.cpp.
~CWeightedDegreeStringKernel | ( | ) | [virtual] |
Definition at line 108 of file WeightedDegreeStringKernel.cpp.
void add_example_to_single_tree | ( | int32_t | idx, | |
float64_t | weight, | |||
int32_t | tree_num | |||
) | [protected] |
add example to single tree
idx | index | |
weight | weight | |
tree_num | which tree |
Definition at line 445 of file WeightedDegreeStringKernel.cpp.
void add_example_to_single_tree_mismatch | ( | int32_t | idx, | |
float64_t | weight, | |||
int32_t | tree_num | |||
) | [protected] |
add example to single tree mismatch
idx | index | |
weight | weight | |
tree_num | which tree |
Definition at line 496 of file WeightedDegreeStringKernel.cpp.
void add_example_to_tree | ( | int32_t | idx, | |
float64_t | weight | |||
) | [protected] |
add example to tree
idx | index | |
weight | weight |
Definition at line 399 of file WeightedDegreeStringKernel.cpp.
void add_example_to_tree_mismatch | ( | int32_t | idx, | |
float64_t | weight | |||
) | [protected] |
add example to tree mismatch
idx | index | |
weight | weight |
Definition at line 470 of file WeightedDegreeStringKernel.cpp.
virtual void add_to_normal | ( | int32_t | idx, | |
float64_t | weight | |||
) | [virtual] |
add to normal
idx | where to add | |
weight | what to add |
Reimplemented from CKernel.
Definition at line 219 of file WeightedDegreeStringKernel.h.
void cleanup | ( | ) | [virtual] |
clean up kernel
Reimplemented from CKernel.
Definition at line 192 of file WeightedDegreeStringKernel.cpp.
virtual void clear_normal | ( | ) | [virtual] |
clear normal subkernel functionality
Reimplemented from CKernel.
Definition at line 205 of file WeightedDegreeStringKernel.h.
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 373 of file WeightedDegreeStringKernel.cpp.
float64_t * compute_abs_weights | ( | int32_t & | len | ) |
compute abs weights
len | len |
Definition at line 575 of file WeightedDegreeStringKernel.cpp.
void compute_batch | ( | int32_t | num_vec, | |
int32_t * | vec_idx, | |||
float64_t * | target, | |||
int32_t | num_suppvec, | |||
int32_t * | IDX, | |||
float64_t * | alphas, | |||
float64_t | factor = 1.0 | |||
) | [virtual] |
compute batch
num_vec | number of vectors | |
vec_idx | vector index | |
target | target | |
num_suppvec | number of support vectors | |
IDX | IDX | |
alphas | alphas | |
factor | factor |
Reimplemented from CKernel.
Definition at line 914 of file WeightedDegreeStringKernel.cpp.
void * compute_batch_helper | ( | void * | p | ) | [static] |
helper for compute batch
p | thread parameter |
Definition at line 878 of file WeightedDegreeStringKernel.cpp.
void compute_by_subkernel | ( | int32_t | idx, | |
float64_t * | subkernel_contrib | |||
) | [virtual] |
compute by subkernel
idx | index | |
subkernel_contrib | subkernel contribution |
Reimplemented from CKernel.
Definition at line 247 of file WeightedDegreeStringKernel.h.
float64_t compute_by_tree | ( | int32_t | idx | ) | [protected] |
compute by tree
idx | index |
Definition at line 524 of file WeightedDegreeStringKernel.cpp.
void compute_by_tree | ( | int32_t | idx, | |
float64_t * | LevelContrib | |||
) |
compute by tree
idx | index | |
LevelContrib | level contribution |
Definition at line 548 of file WeightedDegreeStringKernel.cpp.
virtual float64_t compute_optimized | ( | int32_t | idx | ) | [virtual] |
compute optimized
idx | index to compute |
Reimplemented from CKernel.
Definition at line 172 of file WeightedDegreeStringKernel.h.
float64_t compute_using_block | ( | char * | avec, | |
int32_t | alen, | |||
char * | bvec, | |||
int32_t | blen | |||
) | [protected] |
compute using block
avec | vector a | |
alen | length of vector a | |
bvec | vector b | |
blen | length of vector b |
Definition at line 300 of file WeightedDegreeStringKernel.cpp.
float64_t compute_with_mismatch | ( | char * | avec, | |
int32_t | alen, | |||
char * | bvec, | |||
int32_t | blen | |||
) | [protected] |
compute with mismatch
avec | vector a | |
alen | length of vector a | |
bvec | vector b | |
blen | length of vector b |
Definition at line 272 of file WeightedDegreeStringKernel.cpp.
float64_t compute_without_mismatch | ( | char * | avec, | |
int32_t | alen, | |||
char * | bvec, | |||
int32_t | blen | |||
) | [protected] |
compute without mismatch
avec | vector a | |
alen | length of vector a | |
bvec | vector b | |
blen | length of vector b |
Definition at line 326 of file WeightedDegreeStringKernel.cpp.
float64_t compute_without_mismatch_matrix | ( | char * | avec, | |
int32_t | alen, | |||
char * | bvec, | |||
int32_t | blen | |||
) | [protected] |
compute without mismatch matrix
avec | vector a | |
alen | length of vector a | |
bvec | vector b | |
blen | length of vector b |
Definition at line 349 of file WeightedDegreeStringKernel.cpp.
void create_empty_tries | ( | ) | [protected] |
create emtpy tries
Definition at line 137 of file WeightedDegreeStringKernel.cpp.
bool delete_optimization | ( | ) | [virtual] |
delete optimization
Reimplemented from CKernel.
Definition at line 258 of file WeightedDegreeStringKernel.cpp.
bool delete_position_weights | ( | ) |
delete position weights
Definition at line 490 of file WeightedDegreeStringKernel.h.
int32_t get_degree | ( | ) |
int32_t get_degree | ( | ) | const |
get degree of WD kernel
Definition at line 108 of file WeightedDegreeStringKernel.h.
float64_t* get_degree_weights | ( | int32_t & | d, | |
int32_t & | len | |||
) |
get degree weights
d | degree weights will be stored here | |
len | number of degree weights will be stored here |
Definition at line 355 of file WeightedDegreeStringKernel.h.
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Implements CKernel.
Definition at line 127 of file WeightedDegreeStringKernel.h.
int32_t get_max_mismatch | ( | ) |
get maximum mismatch
Definition at line 508 of file WeightedDegreeStringKernel.h.
int32_t get_max_mismatch | ( | ) | const |
get the number of mismatches that are allowed in WD kernel computation
Definition at line 118 of file WeightedDegreeStringKernel.h.
int32_t get_mkl_stepsize | ( | ) |
get MKL step size
Definition at line 557 of file WeightedDegreeStringKernel.h.
virtual const char* get_name | ( | ) | const [virtual] |
return the kernel's name
Implements CSGObject.
Definition at line 133 of file WeightedDegreeStringKernel.h.
virtual int32_t get_num_subkernels | ( | ) | [virtual] |
get number of subkernels
Reimplemented from CKernel.
Definition at line 233 of file WeightedDegreeStringKernel.h.
float64_t* get_position_weights | ( | int32_t & | len | ) |
get position weights
len | number of position weights will be stored here |
Definition at line 386 of file WeightedDegreeStringKernel.h.
const float64_t* get_subkernel_weights | ( | int32_t & | num_weights | ) | [virtual] |
get subkernel weights
num_weights | number of weights will be stored here |
Reimplemented from CKernel.
Definition at line 264 of file WeightedDegreeStringKernel.h.
EWDKernType get_type | ( | ) | const |
get WD kernel weighting type
Definition at line 99 of file WeightedDegreeStringKernel.h.
bool get_use_block_computation | ( | ) |
check if block computation is performed
Definition at line 538 of file WeightedDegreeStringKernel.h.
float64_t* get_weights | ( | int32_t & | num_weights | ) |
get weights
num_weights | number of weights will be stored here |
Definition at line 367 of file WeightedDegreeStringKernel.h.
int32_t get_which_degree | ( | ) |
initialize kernel
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CStringKernel< char >.
Definition at line 150 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights | ( | ) |
initialize block weights
Definition at line 850 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_const | ( | ) |
initialize block weights constant
Definition at line 735 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_cubicpoly | ( | ) |
initialize block weights cubic polynomial
Definition at line 780 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_exp | ( | ) |
initialize block weights exponential
Definition at line 797 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_external | ( | ) |
initialize block weights external
Definition at line 831 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_from_wd | ( | ) |
initialize block weights from weighted degree
Definition at line 687 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_from_wd_external | ( | ) |
initialize block weights from external weighted degree
Definition at line 707 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_linear | ( | ) |
initialize block weights linear
Definition at line 749 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_log | ( | ) |
initialize block weights logarithmic
Definition at line 814 of file WeightedDegreeStringKernel.cpp.
bool init_block_weights_sqpoly | ( | ) |
initialize block weights squared polynomial
Definition at line 763 of file WeightedDegreeStringKernel.cpp.
bool init_optimization | ( | int32_t | count, | |
int32_t * | IDX, | |||
float64_t * | alphas, | |||
int32_t | tree_num | |||
) | [virtual] |
initialize optimization do initialization for tree_num up to upto_tree, use tree_num=-1 to construct all trees
count | count | |
IDX | IDX | |
alphas | alphas | |
tree_num | which tree |
Definition at line 216 of file WeightedDegreeStringKernel.cpp.
virtual bool init_optimization | ( | int32_t | count, | |
int32_t * | IDX, | |||
float64_t * | alphas | |||
) | [virtual] |
initialize optimization
count | count | |
IDX | index | |
alphas | alphas |
Reimplemented from CKernel.
Definition at line 142 of file WeightedDegreeStringKernel.h.
bool is_tree_initialized | ( | ) |
check if tree is initialized
Definition at line 348 of file WeightedDegreeStringKernel.h.
void remove_lhs | ( | ) | [protected, virtual] |
remove lhs from kernel
Reimplemented from CKernel.
Definition at line 126 of file WeightedDegreeStringKernel.cpp.
bool set_degree | ( | int32_t | deg | ) |
set degree
deg | new degree |
Definition at line 515 of file WeightedDegreeStringKernel.h.
bool set_max_mismatch | ( | int32_t | max | ) |
set maximum mismatch
max | new maximum mismatch |
Definition at line 1018 of file WeightedDegreeStringKernel.cpp.
bool set_mkl_stepsize | ( | int32_t | step | ) |
set MKL steps ize
step | new step size |
Definition at line 545 of file WeightedDegreeStringKernel.h.
bool set_position_weights | ( | float64_t * | position_weights, | |
int32_t | len = 0 | |||
) |
set position weights
position_weights | new position weights | |
len | number of position weights |
Definition at line 658 of file WeightedDegreeStringKernel.cpp.
void set_subkernel_weights | ( | float64_t * | weights2, | |
int32_t | num_weights2 | |||
) | [virtual] |
set subkernel weights
weights2 | weights | |
num_weights2 | number of weights |
Reimplemented from CKernel.
Definition at line 286 of file WeightedDegreeStringKernel.h.
bool set_use_block_computation | ( | bool | block | ) |
set if block computation shall be performed
block | if block computation shall be performed |
Definition at line 528 of file WeightedDegreeStringKernel.h.
void set_wd_weights | ( | float64_t * | p_weights, | |
int32_t | d | |||
) |
set wd weights
p_weights | new eights | |
d | degree |
Definition at line 405 of file WeightedDegreeStringKernel.h.
bool set_wd_weights_by_type | ( | EWDKernType | type | ) |
set wd weights
type | weighted degree kernel type |
if we know a better weighting later on do a switch
Definition at line 581 of file WeightedDegreeStringKernel.cpp.
bool set_weights | ( | float64_t * | weights, | |
int32_t | d, | |||
int32_t | len | |||
) |
set weights
weights | new weights | |
d | degree | |
len | number of weights |
Definition at line 631 of file WeightedDegreeStringKernel.cpp.
bool set_which_degree | ( | int32_t | which | ) |
set which degree
which | which degree |
Definition at line 564 of file WeightedDegreeStringKernel.h.
alphabet of features
Definition at line 887 of file WeightedDegreeStringKernel.h.
bool block_computation [protected] |
if block computation is used
Definition at line 866 of file WeightedDegreeStringKernel.h.
float64_t* block_weights [protected] |
(internal) block weights
Definition at line 874 of file WeightedDegreeStringKernel.h.
float64_t* block_weights_external [protected] |
external block weights
Definition at line 871 of file WeightedDegreeStringKernel.h.
int32_t degree [protected] |
degree
Definition at line 853 of file WeightedDegreeStringKernel.h.
bool initialized [protected] |
if kernel is initialized
Definition at line 863 of file WeightedDegreeStringKernel.h.
int32_t length [protected] |
length
Definition at line 855 of file WeightedDegreeStringKernel.h.
int32_t max_mismatch [protected] |
maximum mismatch
Definition at line 858 of file WeightedDegreeStringKernel.h.
int32_t mkl_stepsize [protected] |
MKL step size
Definition at line 851 of file WeightedDegreeStringKernel.h.
int32_t num_block_weights_external [protected] |
number of external block weights
Definition at line 869 of file WeightedDegreeStringKernel.h.
float64_t* position_weights [protected] |
position weights
Definition at line 847 of file WeightedDegreeStringKernel.h.
int32_t seq_length [protected] |
sequence length
Definition at line 860 of file WeightedDegreeStringKernel.h.
bool tree_initialized [protected] |
if tree is initialized
Definition at line 884 of file WeightedDegreeStringKernel.h.
tries
Definition at line 881 of file WeightedDegreeStringKernel.h.
EWDKernType type [protected] |
WeightedDegree kernel type
Definition at line 876 of file WeightedDegreeStringKernel.h.
degree*length weights length must match seq_length if != 0
Definition at line 845 of file WeightedDegreeStringKernel.h.
float64_t* weights_buffer [protected] |
weights buffer
Definition at line 849 of file WeightedDegreeStringKernel.h.
int32_t which_degree [protected] |
which degree
Definition at line 878 of file WeightedDegreeStringKernel.h.