Public Member Functions | |
CWeightedCommWordStringKernel (int32_t size, bool use_sign) | |
CWeightedCommWordStringKernel (CStringFeatures< uint16_t > *l, CStringFeatures< uint16_t > *r, bool use_sign=false, int32_t size=10) | |
virtual | ~CWeightedCommWordStringKernel () |
virtual bool | init (CFeatures *l, CFeatures *r) |
virtual void | cleanup () |
virtual float64_t | compute_optimized (int32_t idx) |
virtual void | add_to_normal (int32_t idx, float64_t weight) |
void | merge_normal () |
bool | set_wd_weights () |
bool | set_weights (float64_t *w, int32_t d) |
virtual EKernelType | get_kernel_type () |
virtual const char * | get_name () |
virtual EFeatureType | get_feature_type () |
virtual float64_t * | compute_scoring (int32_t max_degree, int32_t &num_feat, int32_t &num_sym, float64_t *target, int32_t num_suppvec, int32_t *IDX, float64_t *alphas, bool do_init=true) |
Protected Member Functions | |
virtual float64_t | compute_helper (int32_t idx_a, int32_t idx_b, bool do_sort) |
Protected Attributes | |
int32_t | degree |
float64_t * | weights |
It basically uses the algorithm in the unix "comm" command (hence the name) to compute:
where maps a sequence
that consists of letters in
to a feature vector of size
. In this feature vector each entry denotes how often the k-mer appears in that
.
Note that this representation is especially tuned to small alphabets (like the 2-bit alphabet DNA), for which it enables spectrum kernels of order 8.
For this kernel the linadd speedups are quite efficiently implemented using direct maps.
Definition at line 47 of file WeightedCommWordStringKernel.h.
CWeightedCommWordStringKernel::CWeightedCommWordStringKernel | ( | int32_t | size, | |
bool | use_sign | |||
) |
constructor
size | cache size | |
use_sign | if sign shall be used |
Definition at line 16 of file WeightedCommWordStringKernel.cpp.
CWeightedCommWordStringKernel::CWeightedCommWordStringKernel | ( | CStringFeatures< uint16_t > * | l, | |
CStringFeatures< uint16_t > * | r, | |||
bool | use_sign = false , |
|||
int32_t | size = 10 | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side | |
use_sign | if sign shall be used | |
size | cache size |
Definition at line 24 of file WeightedCommWordStringKernel.cpp.
CWeightedCommWordStringKernel::~CWeightedCommWordStringKernel | ( | ) | [virtual] |
Definition at line 35 of file WeightedCommWordStringKernel.cpp.
void CWeightedCommWordStringKernel::add_to_normal | ( | int32_t | idx, | |
float64_t | weight | |||
) | [virtual] |
add to normal
idx | where to add | |
weight | what to add |
Reimplemented from CCommWordStringKernel.
Definition at line 178 of file WeightedCommWordStringKernel.cpp.
void CWeightedCommWordStringKernel::cleanup | ( | ) | [virtual] |
clean up kernel
Reimplemented from CCommWordStringKernel.
Definition at line 51 of file WeightedCommWordStringKernel.cpp.
float64_t CWeightedCommWordStringKernel::compute_helper | ( | int32_t | idx_a, | |
int32_t | idx_b, | |||
bool | do_sort | |||
) | [protected, virtual] |
helper for compute
idx_a | index a | |
idx_b | index b | |
do_sort | if sorting shall be performed |
Reimplemented from CCommWordStringKernel.
Definition at line 88 of file WeightedCommWordStringKernel.cpp.
float64_t CWeightedCommWordStringKernel::compute_optimized | ( | int32_t | idx | ) | [virtual] |
compute optimized
idx | index to compute |
Reimplemented from CCommWordStringKernel.
Definition at line 237 of file WeightedCommWordStringKernel.cpp.
float64_t * CWeightedCommWordStringKernel::compute_scoring | ( | int32_t | max_degree, | |
int32_t & | num_feat, | |||
int32_t & | num_sym, | |||
float64_t * | target, | |||
int32_t | num_suppvec, | |||
int32_t * | IDX, | |||
float64_t * | alphas, | |||
bool | do_init = true | |||
) | [virtual] |
compute scoring
max_degree | maximum degree | |
num_feat | number of features | |
num_sym | number of symbols | |
target | target | |
num_suppvec | number of support vectors | |
IDX | IDX | |
alphas | alphas | |
do_init | if initialization shall be performed |
Reimplemented from CCommWordStringKernel.
Definition at line 270 of file WeightedCommWordStringKernel.cpp.
virtual EFeatureType CWeightedCommWordStringKernel::get_feature_type | ( | ) | [virtual] |
return feature type the kernel can deal with
Reimplemented from CCommWordStringKernel.
Definition at line 128 of file WeightedCommWordStringKernel.h.
virtual EKernelType CWeightedCommWordStringKernel::get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Reimplemented from CCommWordStringKernel.
Definition at line 116 of file WeightedCommWordStringKernel.h.
virtual const char* CWeightedCommWordStringKernel::get_name | ( | ) | [virtual] |
return the kernel's name
Reimplemented from CCommWordStringKernel.
Definition at line 122 of file WeightedCommWordStringKernel.h.
initialize kernel
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CCommWordStringKernel.
Definition at line 40 of file WeightedCommWordStringKernel.cpp.
void CWeightedCommWordStringKernel::merge_normal | ( | ) |
merge normal
Definition at line 205 of file WeightedCommWordStringKernel.cpp.
bool CWeightedCommWordStringKernel::set_wd_weights | ( | ) |
set weighted degree weights
Definition at line 59 of file WeightedCommWordStringKernel.cpp.
bool CWeightedCommWordStringKernel::set_weights | ( | float64_t * | w, | |
int32_t | d | |||
) |
set custom weights (swig compatible)
w | weights | |
d | degree (must match number of weights) |
Definition at line 77 of file WeightedCommWordStringKernel.cpp.
int32_t CWeightedCommWordStringKernel::degree [protected] |
degree
Definition at line 158 of file WeightedCommWordStringKernel.h.
float64_t* CWeightedCommWordStringKernel::weights [protected] |
weights for each of the subkernels of degree 1...d
Definition at line 161 of file WeightedCommWordStringKernel.h.