12 #ifndef _WEIGHTEDDEGREEPOSITIONSTRINGKERNEL_H___
13 #define _WEIGHTEDDEGREEPOSITIONSTRINGKERNEL_H___
64 int32_t size, int32_t
degree,
113 virtual const char*
get_name()
const {
return "WeightedDegreePositionStringKernel"; }
123 int32_t p_count, int32_t *IDX,
float64_t * alphas)
140 int32_t count, int32_t *IDX,
float64_t * alphas, int32_t tree_num,
141 int32_t upto_tree=-1);
179 int32_t num_vec, int32_t* vec_idx,
float64_t* target,
180 int32_t num_suppvec, int32_t* IDX,
float64_t* alphas,
191 SG_DEBUG(
"disabling compact trie nodes with FASTBUTMEMHUNGRY\n")
201 SG_ERROR(
"unknown optimization type\n")
237 int32_t idx,
float64_t * subkernel_contrib)
245 SG_ERROR(
"CWeightedDegreePositionStringKernel optimization not initialized\n")
261 for (int32_t i=0; i<num_weights; i++)
264 for (int32_t i=0; i<num_weights; i++)
277 int32_t num_weights2=w.
vlen;
280 if (num_weights!=num_weights2)
281 SG_ERROR(
"number of weights do not match\n")
284 for (int32_t i=0; i<num_weights; i++)
292 for (int32_t i=0; i<num_weights; i++)
295 weights[i*mkl_stepsize+j] = weights2[i] ;
299 for (int32_t i=0; i<num_weights; i++)
302 weights[i*mkl_stepsize+j] = weights2[i] ;
359 num_weights = degree*
length ;
531 int32_t max_degree, int32_t& num_feat, int32_t& num_sym,
532 float64_t* target, int32_t num_suppvec, int32_t* IDX,
544 int32_t &num_feat, int32_t num_suppvec, int32_t* IDX,
559 int32_t max_degree, int32_t& num_feat, int32_t& num_sym,
560 float64_t* w_result, int32_t num_suppvec, int32_t* IDX,
576 int32_t max_degree, int32_t& num_feat, int32_t& num_sym,
577 float64_t* poim_result, int32_t num_suppvec, int32_t* IDX,
622 int32_t idx,
float64_t weight, int32_t tree_num);
643 char* avec, int32_t alen,
char* bvec, int32_t blen);
654 char* avec, int32_t alen,
char* bvec, int32_t blen);
665 char* avec, int32_t alen,
char* bvec, int32_t blen);
678 char* avec,
float64_t *posweights_lhs, int32_t alen,
679 char* bvec,
float64_t *posweights_rhs, int32_t blen);
734 int32_t max_mismatch;
virtual bool init(CFeatures *l, CFeatures *r)
void compute_POIM2(int32_t max_degree, CSVM *svm)
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
void delete_trees(bool p_use_compact_terminal_nodes=true)
virtual const char * get_name() const
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)
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)
void add_example_to_single_tree(int32_t idx, float64_t weight, int32_t tree_num)
SGVector< float64_t > get_POIM2()
virtual void add_to_normal(int32_t idx, float64_t weight)
Template class Trie implements a suffix trie, i.e. a tree in which all suffixes up to a certain lengt...
void cleanup_POIM2()
cleanup POIM2
float64_t compute_with_mismatch(char *avec, int32_t alen, char *bvec, int32_t blen)
virtual ~CWeightedDegreePositionStringKernel()
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
float64_t * compute_abs_weights(int32_t &len)
void create_empty_tries()
EAlphabet get_alphabet() const
bool set_weights(SGMatrix< float64_t > new_weights)
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)
int32_t position_weights_rhs_len
bool is_tree_initialized()
void set_is_initialized(bool p_init)
The class Alphabet implements an alphabet and alphabet utility functions.
bool delete_position_weights()
virtual void load_serializable_post()
bool init_block_weights_cubicpoly()
float64_t * position_weights_lhs
virtual bool delete_optimization()
float64_t * weights_buffer
bool init_block_weights_linear()
float64_t * get_weights(int32_t &num_weights)
bool init_block_weights_sqpoly()
bool get_is_initialized()
virtual void remove_lhs()
int32_t position_weights_len
bool init_block_weights_from_wd_external()
CWeightedDegreePositionStringKernel()
bool init_block_weights_log()
void prepare_POIM2(SGMatrix< float64_t > distrib)
int32_t m_poim_result_len
virtual bool init_optimization(int32_t p_count, int32_t *IDX, float64_t *alphas)
void set_shifts(SGVector< int32_t > shifts)
float64_t * block_weights
bool init_block_weights_exp()
void set_use_compact_terminal_nodes(bool p_use_compact_terminal_nodes)
float64_t * get_position_weights(int32_t &len)
virtual void add_example_to_tree(int32_t idx, float64_t weight)
bool init_block_weights_const()
bool init_block_weights()
float64_t * m_poim_distrib
virtual int32_t get_num_subkernels()
bool delete_position_weights_rhs()
bool delete_position_weights_lhs()
float64_t compute_without_mismatch_matrix(char *avec, int32_t alen, char *bvec, int32_t blen)
virtual void set_position_weights(SGVector< float64_t > pws)
float64_t * position_weights
EOptimizationType opt_type
virtual void set_subkernel_weights(SGVector< float64_t > w)
bool set_position_weights_lhs(float64_t *pws, int32_t len, int32_t num)
float64_t * position_weights_rhs
const float64_t * get_subkernel_weights(int32_t &num_weights)
CTrie< POIMTrie > poim_tries
char * compute_consensus(int32_t &num_feat, int32_t num_suppvec, int32_t *IDX, float64_t *alphas)
all of classes and functions are contained in the shogun namespace
virtual bool set_wd_weights()
void compute_by_subkernel(int32_t idx, float64_t *subkernel_contrib)
virtual EKernelType get_kernel_type()
The class Features is the base class of all feature objects.
static void * compute_batch_helper(void *p)
A generic Support Vector Machine Interface.
float64_t * get_degree_weights(int32_t &d, int32_t &len)
int32_t get_max_mismatch()
bool get_use_compact_terminal_nodes()
virtual float64_t compute_optimized(int32_t idx)
bool set_position_weights_rhs(float64_t *pws, int32_t len, int32_t num)
virtual float64_t compute_by_tree(int32_t idx)
The Weighted Degree Position String kernel (Weighted Degree kernel with shifts).
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)
virtual void clear_normal()
Template class StringKernel, is the base class of all String Kernels.
int32_t position_weights_lhs_len
float64_t compute_without_mismatch(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)
bool init_block_weights_from_wd()