SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
CWeightedDegreePositionStringKernel Class Reference

Detailed Description

The Weighted Degree Position String kernel (Weighted Degree kernel with shifts).

The WD-shift kernel of order d compares two sequences ${\bf x}$ and ${\bf x'}$ of length L by summing all contributions of k-mer matches of lengths $k\in\{1,\dots,d\}$, weighted by coefficients $\beta_k$ allowing for a positional tolerance of up to shift s.

It is formally defined as

\begin{eqnarray*} &&\!\!\!\!\!\!\!k({\bf x}_i,{\bf x}_j)=\sum_{k=1}^d\beta_k\sum_{l=1}^{\!\!\!\!L-k+1\!\!\!\!}\gamma_l\sum_{\begin{array}{c}s=0\\ \!\!\!\!s+l\leq L\!\!\!\!\end{array}}^{S(l)} \delta_s\;\mu_{k,l,s,{{\bf x}_i},{{\bf x}_j}},\\ &&\!\!\!\!\!\!\!\!\!\! {\footnotesize \mu_{k,l,s,{{\bf x}_i},{{\bf x}_j}}\!\!\! =\!\! I({\bf u}_{k,l+s}({\bf x}_i)\! =\!{\bf u}_{k,l}({\bf x}_j))\! +\!I({\bf u}_{k,l}({\bf x}_i)\! =\!{\bf u}_{k,l+s}({\bf x}_j))},\nonumber \end{eqnarray*}

where $\beta_j$ are the weighting coefficients of the j-mers, $\gamma_l$ is a weighting over the position in the sequence, $\delta_s=1/(2(s+1))$ is the weight assigned to shifts (in either direction) of extent s, and S(l) determines the shift range at position l.

Definition at line 48 of file WeightedDegreePositionStringKernel.h.

Inheritance diagram for CWeightedDegreePositionStringKernel:
Inheritance graph
[legend]

Public Member Functions

 CWeightedDegreePositionStringKernel ()
 CWeightedDegreePositionStringKernel (int32_t size, int32_t degree, int32_t max_mismatch=0, int32_t mkl_stepsize=1)
 CWeightedDegreePositionStringKernel (int32_t size, float64_t *weights, int32_t degree, int32_t max_mismatch, int32_t *shift, int32_t shift_len, int32_t mkl_stepsize=1)
 CWeightedDegreePositionStringKernel (CStringFeatures< char > *l, CStringFeatures< char > *r, int32_t degree)
virtual ~CWeightedDegreePositionStringKernel ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual EKernelType get_kernel_type ()
virtual const char * get_name () const
virtual bool init_optimization (int32_t p_count, int32_t *IDX, float64_t *alphas)
virtual bool init_optimization (int32_t count, int32_t *IDX, float64_t *alphas, int32_t tree_num, int32_t upto_tree=-1)
virtual bool delete_optimization ()
virtual float64_t compute_optimized (int32_t idx)
virtual 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 void clear_normal ()
virtual void add_to_normal (int32_t idx, float64_t weight)
virtual int32_t get_num_subkernels ()
void compute_by_subkernel (int32_t idx, float64_t *subkernel_contrib)
const float64_tget_subkernel_weights (int32_t &num_weights)
virtual void set_subkernel_weights (SGVector< float64_t > w)
float64_tcompute_abs_weights (int32_t &len)
bool is_tree_initialized ()
int32_t get_max_mismatch ()
int32_t get_degree ()
float64_tget_degree_weights (int32_t &d, int32_t &len)
float64_tget_weights (int32_t &num_weights)
float64_tget_position_weights (int32_t &len)
void set_shifts (SGVector< int32_t > shifts)
bool set_weights (SGMatrix< float64_t > new_weights)
virtual bool set_wd_weights ()
virtual void set_position_weights (SGVector< float64_t > pws)
bool set_position_weights_lhs (float64_t *pws, int32_t len, int32_t num)
bool set_position_weights_rhs (float64_t *pws, int32_t len, int32_t num)
bool init_block_weights ()
bool init_block_weights_from_wd ()
bool init_block_weights_from_wd_external ()
bool init_block_weights_const ()
bool init_block_weights_linear ()
bool init_block_weights_sqpoly ()
bool init_block_weights_cubicpoly ()
bool init_block_weights_exp ()
bool init_block_weights_log ()
bool delete_position_weights ()
bool delete_position_weights_lhs ()
bool delete_position_weights_rhs ()
virtual float64_t compute_by_tree (int32_t idx)
virtual void compute_by_tree (int32_t idx, float64_t *LevelContrib)
float64_tcompute_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 *weights)
char * compute_consensus (int32_t &num_feat, int32_t num_suppvec, int32_t *IDX, float64_t *alphas)
float64_textract_w (int32_t max_degree, int32_t &num_feat, int32_t &num_sym, float64_t *w_result, int32_t num_suppvec, int32_t *IDX, float64_t *alphas)
float64_tcompute_POIM (int32_t max_degree, int32_t &num_feat, int32_t &num_sym, float64_t *poim_result, int32_t num_suppvec, int32_t *IDX, float64_t *alphas, float64_t *distrib)
void prepare_POIM2 (float64_t *distrib, int32_t num_sym, int32_t num_feat)
void compute_POIM2 (int32_t max_degree, CSVM *svm)
void get_POIM2 (float64_t **poim, int32_t *result_len)
void cleanup_POIM2 ()
 cleanup POIM2
- Public Member Functions inherited from CStringKernel< char >
 CStringKernel (int32_t cachesize=0)
 CStringKernel (CFeatures *l, CFeatures *r)
virtual EFeatureClass get_feature_class ()
virtual EFeatureType get_feature_type ()
- Public Member Functions inherited from CKernel
 CKernel ()
 CKernel (int32_t size)
 CKernel (CFeatures *l, CFeatures *r, int32_t size)
virtual ~CKernel ()
float64_t kernel (int32_t idx_a, int32_t idx_b)
SGMatrix< float64_tget_kernel_matrix ()
virtual SGVector< float64_tget_kernel_col (int32_t j)
virtual SGVector< float64_tget_kernel_row (int32_t i)
template<class T >
SGMatrix< T > get_kernel_matrix ()
virtual bool set_normalizer (CKernelNormalizer *normalizer)
virtual CKernelNormalizerget_normalizer ()
virtual bool init_normalizer ()
void load (CFile *loader)
void save (CFile *writer)
CFeaturesget_lhs ()
CFeaturesget_rhs ()
virtual int32_t get_num_vec_lhs ()
virtual int32_t get_num_vec_rhs ()
virtual bool has_features ()
bool get_lhs_equals_rhs ()
virtual void remove_lhs_and_rhs ()
virtual void remove_rhs ()
 takes all necessary steps if the rhs is removed from kernel
void set_cache_size (int32_t size)
int32_t get_cache_size ()
void list_kernel ()
bool has_property (EKernelProperty p)
EOptimizationType get_optimization_type ()
virtual void set_optimization_type (EOptimizationType t)
bool get_is_initialized ()
bool init_optimization_svm (CSVM *svm)
float64_t get_combined_kernel_weight ()
void set_combined_kernel_weight (float64_t nw)
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Static Public Member Functions

static void * compute_batch_helper (void *p)

Protected Member Functions

void create_empty_tries ()
virtual void add_example_to_tree (int32_t idx, float64_t weight)
void add_example_to_single_tree (int32_t idx, float64_t weight, int32_t tree_num)
virtual float64_t compute (int32_t idx_a, int32_t idx_b)
float64_t compute_with_mismatch (char *avec, int32_t alen, char *bvec, int32_t blen)
float64_t compute_without_mismatch (char *avec, int32_t alen, char *bvec, int32_t blen)
float64_t compute_without_mismatch_matrix (char *avec, int32_t alen, char *bvec, int32_t blen)
float64_t compute_without_mismatch_position_weights (char *avec, float64_t *posweights_lhs, int32_t alen, char *bvec, float64_t *posweights_rhs, int32_t blen)
virtual void remove_lhs ()
virtual void load_serializable_post () throw (ShogunException)

Protected Attributes

float64_tweights
int32_t weights_degree
int32_t weights_length
float64_tposition_weights
int32_t position_weights_len
float64_tposition_weights_lhs
int32_t position_weights_lhs_len
float64_tposition_weights_rhs
int32_t position_weights_rhs_len
bool * position_mask
float64_tweights_buffer
int32_t mkl_stepsize
int32_t degree
int32_t length
int32_t max_mismatch
int32_t seq_length
int32_t * shift
int32_t shift_len
int32_t max_shift
bool block_computation
float64_tblock_weights
EWDKernType type
int32_t which_degree
CTrie< DNATrie > tries
CTrie< POIMTrie > poim_tries
bool tree_initialized
bool use_poim_tries
float64_tm_poim_distrib
float64_tm_poim
int32_t m_poim_num_sym
int32_t m_poim_num_feat
int32_t m_poim_result_len
CAlphabetalphabet

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Static Protected Member Functions inherited from CKernel
template<class T >
static void * get_kernel_matrix_helper (void *p)

Constructor & Destructor Documentation

default constructor

Definition at line 52 of file WeightedDegreePositionStringKernel.cpp.

CWeightedDegreePositionStringKernel ( int32_t  size,
int32_t  degree,
int32_t  max_mismatch = 0,
int32_t  mkl_stepsize = 1 
)

constructor

Parameters
sizecache size
degreedegree
max_mismatchmaximum mismatch
mkl_stepsizeMKL stepsize

Definition at line 59 of file WeightedDegreePositionStringKernel.cpp.

CWeightedDegreePositionStringKernel ( int32_t  size,
float64_t weights,
int32_t  degree,
int32_t  max_mismatch,
int32_t *  shift,
int32_t  shift_len,
int32_t  mkl_stepsize = 1 
)

constructor

Parameters
sizecache size
weightsweights
degreedegree
max_mismatchmaximum mismatch
shiftposition shifts
shift_lennumber of shifts
mkl_stepsizeMKL stepsize

Definition at line 76 of file WeightedDegreePositionStringKernel.cpp.

CWeightedDegreePositionStringKernel ( CStringFeatures< char > *  l,
CStringFeatures< char > *  r,
int32_t  degree 
)

constructor

Parameters
lfeatures of left-hand side
rfeatures of right-hand side
degreedegree

Definition at line 100 of file WeightedDegreePositionStringKernel.cpp.

Definition at line 119 of file WeightedDegreePositionStringKernel.cpp.

Member Function Documentation

void add_example_to_single_tree ( int32_t  idx,
float64_t  weight,
int32_t  tree_num 
)
protected

add example to single tree

Parameters
idxindex
weightweight
tree_numwhich tree

Definition at line 695 of file WeightedDegreePositionStringKernel.cpp.

void add_example_to_tree ( int32_t  idx,
float64_t  weight 
)
protectedvirtual

add example to tree

Parameters
idxindex
weightweight

Definition at line 644 of file WeightedDegreePositionStringKernel.cpp.

virtual void add_to_normal ( int32_t  idx,
float64_t  weight 
)
virtual

add to normal

Parameters
idxwhere to add
weightwhat to add

Reimplemented from CKernel.

Definition at line 211 of file WeightedDegreePositionStringKernel.h.

void cleanup ( )
virtual

clean up kernel

Reimplemented from CKernel.

Definition at line 227 of file WeightedDegreePositionStringKernel.cpp.

void cleanup_POIM2 ( )

cleanup POIM2

Definition at line 1870 of file WeightedDegreePositionStringKernel.cpp.

virtual void clear_normal ( )
virtual

clear normal subkernel functionality

Reimplemented from CKernel.

Definition at line 185 of file WeightedDegreePositionStringKernel.h.

float64_t compute ( int32_t  idx_a,
int32_t  idx_b 
)
protectedvirtual

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_aindex a
idx_bindex b
Returns
computed kernel function at indices a,b

Implements CKernel.

Definition at line 608 of file WeightedDegreePositionStringKernel.cpp.

float64_t * compute_abs_weights ( int32_t &  len)

compute abs weights

Parameters
lenlen
Returns
computed abs weights

Definition at line 831 of file WeightedDegreePositionStringKernel.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

Parameters
num_vecnumber of vectors
vec_idxvector index
targettarget
num_suppvecnumber of support vectors
IDXIDX
alphasalphas
factorfactor

Reimplemented from CKernel.

Definition at line 1230 of file WeightedDegreePositionStringKernel.cpp.

void * compute_batch_helper ( void *  p)
static

helper for compute batch

Parameters
pthread parameter

Definition at line 1172 of file WeightedDegreePositionStringKernel.cpp.

void compute_by_subkernel ( int32_t  idx,
float64_t subkernel_contrib 
)
virtual

compute by subkernel

Parameters
idxindex
subkernel_contribsubkernel contribution

Reimplemented from CKernel.

Definition at line 235 of file WeightedDegreePositionStringKernel.h.

float64_t compute_by_tree ( int32_t  idx)
virtual

compute by tree

Parameters
idxindex
Returns
computed value

Definition at line 749 of file WeightedDegreePositionStringKernel.cpp.

void compute_by_tree ( int32_t  idx,
float64_t LevelContrib 
)
virtual

compute by tree

Parameters
idxindex
LevelContriblevel contribution

Definition at line 788 of file WeightedDegreePositionStringKernel.cpp.

char * compute_consensus ( int32_t &  num_feat,
int32_t  num_suppvec,
int32_t *  IDX,
float64_t alphas 
)

compute consensus string

Parameters
num_featnumber of features
num_suppvecnumber of support vectors
IDXIDX
alphasalphas
Returns
consensus string

Definition at line 1499 of file WeightedDegreePositionStringKernel.cpp.

virtual float64_t compute_optimized ( int32_t  idx)
virtual

compute optimized

Parameters
idxindex to compute
Returns
optimized value at given index

Reimplemented from CKernel.

Definition at line 153 of file WeightedDegreePositionStringKernel.h.

float64_t * compute_POIM ( int32_t  max_degree,
int32_t &  num_feat,
int32_t &  num_sym,
float64_t poim_result,
int32_t  num_suppvec,
int32_t *  IDX,
float64_t alphas,
float64_t distrib 
)

compute POIM

Parameters
max_degreemaximum degree
num_featnumber of features
num_symnumber of symbols
poim_resultpoim
num_suppvecnumber of support vectors
IDXIDX
alphasalphas
distribdistribution
Returns
computed POIMs

Definition at line 1679 of file WeightedDegreePositionStringKernel.cpp.

void compute_POIM2 ( int32_t  max_degree,
CSVM svm 
)

compute POIM2

Parameters
max_degreemaximum degree
svmSVM

Definition at line 1826 of file WeightedDegreePositionStringKernel.cpp.

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 weights 
)

compute positional scoring function, which assigns a weight per position, per symbol in the sequence

Parameters
max_degreemaximum degree
num_featnumber of features
num_symnumber of symbols
targettarget
num_suppvecnumber of support vectors
IDXIDX
weightsweights
Returns
computed scores

Definition at line 1343 of file WeightedDegreePositionStringKernel.cpp.

float64_t compute_with_mismatch ( char *  avec,
int32_t  alen,
char *  bvec,
int32_t  blen 
)
protected

compute with mismatch

Parameters
avecvector a
alenlength of vector a
bvecvector b
blenlength of vector b
Returns
computed value

Definition at line 318 of file WeightedDegreePositionStringKernel.cpp.

float64_t compute_without_mismatch ( char *  avec,
int32_t  alen,
char *  bvec,
int32_t  blen 
)
protected

compute without mismatch

Parameters
avecvector a
alenlength of vector a
bvecvector b
blenlength of vector b
Returns
computed value

Definition at line 398 of file WeightedDegreePositionStringKernel.cpp.

float64_t compute_without_mismatch_matrix ( char *  avec,
int32_t  alen,
char *  bvec,
int32_t  blen 
)
protected

compute without mismatch matrix

Parameters
avecvector a
alenlength of vector a
bvecvector b
blenlength of vector b
Returns
computed value

Definition at line 464 of file WeightedDegreePositionStringKernel.cpp.

float64_t compute_without_mismatch_position_weights ( char *  avec,
float64_t posweights_lhs,
int32_t  alen,
char *  bvec,
float64_t posweights_rhs,
int32_t  blen 
)
protected

compute without mismatch position weights

Parameters
avecvector a
posweights_lhsposition weights left-hand side
alenlength of vector a
bvecvector b
posweights_rhsposition weights right-hand side
blenlength of vector b
Returns
computed value

Definition at line 528 of file WeightedDegreePositionStringKernel.cpp.

void create_empty_tries ( )
protected

create emtpy tries

Definition at line 159 of file WeightedDegreePositionStringKernel.cpp.

bool delete_optimization ( )
virtual

delete optimization

Returns
if deleting was successful

Reimplemented from CKernel.

Definition at line 293 of file WeightedDegreePositionStringKernel.cpp.

bool delete_position_weights ( )

delete position weights

Returns
if deleting was successful

Definition at line 475 of file WeightedDegreePositionStringKernel.h.

bool delete_position_weights_lhs ( )

delete position weights left-hand side

Returns
if deleting was successful

Definition at line 486 of file WeightedDegreePositionStringKernel.h.

bool delete_position_weights_rhs ( )

delete position weights right-hand side

Returns
if deleting was successful

Definition at line 497 of file WeightedDegreePositionStringKernel.h.

float64_t * extract_w ( int32_t  max_degree,
int32_t &  num_feat,
int32_t &  num_sym,
float64_t w_result,
int32_t  num_suppvec,
int32_t *  IDX,
float64_t alphas 
)

extract w

Parameters
max_degreemaximum degree
num_featnumber of features
num_symnumber of symbols
w_resultw
num_suppvecnumber of support vectors
IDXIDX
alphasalphas
Returns
w

Definition at line 1616 of file WeightedDegreePositionStringKernel.cpp.

int32_t get_degree ( )

get degree

Returns
the degree

Definition at line 330 of file WeightedDegreePositionStringKernel.h.

float64_t* get_degree_weights ( int32_t &  d,
int32_t &  len 
)

get degree weights

Parameters
ddegree weights will be stored here
lennumber of degree weights will be stored here

Definition at line 337 of file WeightedDegreePositionStringKernel.h.

virtual EKernelType get_kernel_type ( )
virtual

return what type of kernel we are

Returns
kernel type WEIGHTEDDEGREEPOS

Implements CStringKernel< char >.

Definition at line 106 of file WeightedDegreePositionStringKernel.h.

int32_t get_max_mismatch ( )

get maximum mismatch

Returns
maximum mismatch

Definition at line 324 of file WeightedDegreePositionStringKernel.h.

virtual const char* get_name ( ) const
virtual

return the kernel's name

Returns
name WeightedDegreePos

Reimplemented from CStringKernel< char >.

Definition at line 112 of file WeightedDegreePositionStringKernel.h.

virtual int32_t get_num_subkernels ( )
virtual

get number of subkernels

Returns
number of subkernels

Reimplemented from CKernel.

Definition at line 221 of file WeightedDegreePositionStringKernel.h.

void get_POIM2 ( float64_t **  poim,
int32_t *  result_len 
)

get POIM2

Parameters
poimPOIMs (returned)
result_len(returned)

Definition at line 1861 of file WeightedDegreePositionStringKernel.cpp.

float64_t* get_position_weights ( int32_t &  len)

get position weights

Parameters
lennumber of position weights will be stored here
Returns
position weights

Definition at line 368 of file WeightedDegreePositionStringKernel.h.

const float64_t* get_subkernel_weights ( int32_t &  num_weights)
virtual

get subkernel weights

Parameters
num_weightsnumber of weights will be stored here
Returns
subkernel weights

Reimplemented from CKernel.

Definition at line 252 of file WeightedDegreePositionStringKernel.h.

float64_t* get_weights ( int32_t &  num_weights)

get weights

Parameters
num_weightsnumber of weights will be stored here
Returns
weights

Definition at line 349 of file WeightedDegreePositionStringKernel.h.

bool init ( CFeatures l,
CFeatures r 
)
virtual

initialize kernel

Parameters
lfeatures of left-hand side
rfeatures of right-hand side
Returns
if initializing was successful

Reimplemented from CStringKernel< char >.

Definition at line 178 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights ( )

initialize block weights

Returns
if initialization was successful

Definition at line 1146 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_const ( )

initialize block weights constant

Returns
if initialization was successful

Definition at line 1050 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_cubicpoly ( )

initialize block weights cubic polynomial

Returns
if initialization was successful

Definition at line 1095 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_exp ( )

initialize block weights exponential

Returns
if initialization was successful

Definition at line 1112 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_from_wd ( )

initialize block weights from weighted degree

Returns
if initialization was successful

Definition at line 1002 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_from_wd_external ( )

initialize block weights from external weighted degree

Returns
if initialization was successful

Definition at line 1022 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_linear ( )

initialize block weights linear

Returns
if initialization was successful

Definition at line 1064 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_log ( )

initialize block weights logarithmic

Returns
if initialization was successful

Definition at line 1129 of file WeightedDegreePositionStringKernel.cpp.

bool init_block_weights_sqpoly ( )

initialize block weights squared polynomial

Returns
if initialization was successful

Definition at line 1078 of file WeightedDegreePositionStringKernel.cpp.

virtual bool init_optimization ( int32_t  p_count,
int32_t *  IDX,
float64_t alphas 
)
virtual

initialize optimization

Parameters
p_countcount
IDXindex
alphasalphas
Returns
if initializing was successful

Reimplemented from CKernel.

Definition at line 121 of file WeightedDegreePositionStringKernel.h.

bool init_optimization ( int32_t  count,
int32_t *  IDX,
float64_t alphas,
int32_t  tree_num,
int32_t  upto_tree = -1 
)
virtual

initialize optimization do initialization for tree_num up to upto_tree, use tree_num=-1 to construct all trees

Parameters
countcount
IDXIDX
alphasalphas
tree_numwhich tree
upto_treeup to this tree
Returns
if initializing was successful

Definition at line 247 of file WeightedDegreePositionStringKernel.cpp.

bool is_tree_initialized ( )

check if tree is initialized

Returns
if tree is initialized

Definition at line 318 of file WeightedDegreePositionStringKernel.h.

void load_serializable_post ( ) throw (ShogunException)
protectedvirtual

Can (optionally) be overridden to post-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::LOAD_SERIALIZABLE_POST is called.

Exceptions
ShogunExceptionWill be thrown if an error occurres.

Reimplemented from CKernel.

Definition at line 1881 of file WeightedDegreePositionStringKernel.cpp.

void prepare_POIM2 ( float64_t distrib,
int32_t  num_sym,
int32_t  num_feat 
)

prepare POIM2

Parameters
num_featnumber of features
num_symnumber of symbols
distribdistribution

Definition at line 1815 of file WeightedDegreePositionStringKernel.cpp.

void remove_lhs ( )
protectedvirtual

remove lhs from kernel

Reimplemented from CKernel.

Definition at line 148 of file WeightedDegreePositionStringKernel.cpp.

void set_position_weights ( SGVector< float64_t pws)
virtual

set position weights

Parameters
pwsnew position weights
Returns
if setting was successful

Definition at line 928 of file WeightedDegreePositionStringKernel.cpp.

bool set_position_weights_lhs ( float64_t pws,
int32_t  len,
int32_t  num 
)

set position weights for left-hand side

Parameters
pwsnew position weights
lenlen
numnum
Returns
if setting was successful

Definition at line 945 of file WeightedDegreePositionStringKernel.cpp.

bool set_position_weights_rhs ( float64_t pws,
int32_t  len,
int32_t  num 
)

set position weights for right-hand side

Parameters
pwsnew position weights
lenlen
numnum
Returns
if setting was successful

Definition at line 973 of file WeightedDegreePositionStringKernel.cpp.

void set_shifts ( SGVector< int32_t >  shifts)

set shifts

Parameters
shiftsnew shifts

Definition at line 837 of file WeightedDegreePositionStringKernel.cpp.

virtual void set_subkernel_weights ( SGVector< float64_t w)
virtual

set subkernel weights

Parameters
weights2weights
num_weights2number of weights

Reimplemented from CKernel.

Definition at line 274 of file WeightedDegreePositionStringKernel.h.

bool set_wd_weights ( )
virtual

set wd weights

Returns
if setting was successful

Definition at line 858 of file WeightedDegreePositionStringKernel.cpp.

bool set_weights ( SGMatrix< float64_t new_weights)

set weights

Parameters
new_weightsnew weights

Definition at line 899 of file WeightedDegreePositionStringKernel.cpp.

Member Data Documentation

CAlphabet* alphabet
protected

alphabet of features

Definition at line 782 of file WeightedDegreePositionStringKernel.h.

bool block_computation
protected

if block computation is used

Definition at line 750 of file WeightedDegreePositionStringKernel.h.

float64_t* block_weights
protected

(internal) block weights

Definition at line 753 of file WeightedDegreePositionStringKernel.h.

int32_t degree
protected

degree

Definition at line 733 of file WeightedDegreePositionStringKernel.h.

int32_t length
protected

length

Definition at line 735 of file WeightedDegreePositionStringKernel.h.

float64_t* m_poim
protected

temporary memory for the interface to the poim functions

Definition at line 772 of file WeightedDegreePositionStringKernel.h.

float64_t* m_poim_distrib
protected

temporary memory for the interface to the poim functions

Definition at line 770 of file WeightedDegreePositionStringKernel.h.

int32_t m_poim_num_feat
protected

length of string (==num_feat)

Definition at line 777 of file WeightedDegreePositionStringKernel.h.

int32_t m_poim_num_sym
protected

number of symbols

Definition at line 775 of file WeightedDegreePositionStringKernel.h.

int32_t m_poim_result_len
protected

total size of poim array

Definition at line 779 of file WeightedDegreePositionStringKernel.h.

int32_t max_mismatch
protected

maximum mismatch

Definition at line 738 of file WeightedDegreePositionStringKernel.h.

int32_t max_shift
protected

maximum shift

Definition at line 747 of file WeightedDegreePositionStringKernel.h.

int32_t mkl_stepsize
protected

MKL stepsize

Definition at line 730 of file WeightedDegreePositionStringKernel.h.

CTrie<POIMTrie> poim_tries
protected

POIM tries

Definition at line 762 of file WeightedDegreePositionStringKernel.h.

bool* position_mask
protected

position mask

Definition at line 725 of file WeightedDegreePositionStringKernel.h.

float64_t* position_weights
protected

position weights

Definition at line 712 of file WeightedDegreePositionStringKernel.h.

int32_t position_weights_len
protected

position weights len

Definition at line 714 of file WeightedDegreePositionStringKernel.h.

float64_t* position_weights_lhs
protected

position weights left-hand side

Definition at line 717 of file WeightedDegreePositionStringKernel.h.

int32_t position_weights_lhs_len
protected

position weights len

Definition at line 719 of file WeightedDegreePositionStringKernel.h.

float64_t* position_weights_rhs
protected

position weights right-hand side

Definition at line 721 of file WeightedDegreePositionStringKernel.h.

int32_t position_weights_rhs_len
protected

position weights len

Definition at line 723 of file WeightedDegreePositionStringKernel.h.

int32_t seq_length
protected

length of sequence

Definition at line 740 of file WeightedDegreePositionStringKernel.h.

int32_t* shift
protected

shifts

Definition at line 743 of file WeightedDegreePositionStringKernel.h.

int32_t shift_len
protected

length of shifts

Definition at line 745 of file WeightedDegreePositionStringKernel.h.

bool tree_initialized
protected

if tree is initialized

Definition at line 765 of file WeightedDegreePositionStringKernel.h.

CTrie<DNATrie> tries
protected

tries

Definition at line 760 of file WeightedDegreePositionStringKernel.h.

EWDKernType type
protected

WeightedDegree kernel type

Definition at line 755 of file WeightedDegreePositionStringKernel.h.

bool use_poim_tries
protected

makes add_example_to_tree (ONLY!) use POIMTrie

Definition at line 767 of file WeightedDegreePositionStringKernel.h.

float64_t* weights
protected

weights

Definition at line 705 of file WeightedDegreePositionStringKernel.h.

float64_t* weights_buffer
protected

weights buffer

Definition at line 728 of file WeightedDegreePositionStringKernel.h.

int32_t weights_degree
protected

degree

Definition at line 707 of file WeightedDegreePositionStringKernel.h.

int32_t weights_length
protected

length

Definition at line 709 of file WeightedDegreePositionStringKernel.h.

int32_t which_degree
protected

which degree

Definition at line 757 of file WeightedDegreePositionStringKernel.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation