Features that compute the Weighted Spectrum Kernel feature space explicitly.
Definition at line 26 of file ImplicitWeightedSpecFeatures.h.
Public Member Functions | |
CImplicitWeightedSpecFeatures (CStringFeatures< uint16_t > *str, bool normalize=true) | |
CImplicitWeightedSpecFeatures (const CImplicitWeightedSpecFeatures &orig) | |
virtual | ~CImplicitWeightedSpecFeatures () |
virtual CFeatures * | duplicate () const |
virtual int32_t | get_dim_feature_space () |
virtual float64_t | dot (int32_t vec_idx1, int32_t vec_idx2) |
virtual float64_t | dense_dot (int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len) |
virtual void | add_to_dense_vec (float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false) |
virtual int32_t | get_nnz_features_for_vector (int32_t num) |
virtual EFeatureType | get_feature_type () |
virtual EFeatureClass | get_feature_class () |
virtual int32_t | get_num_vectors () |
virtual int32_t | get_size () |
bool | set_wd_weights () |
bool | set_weights (float64_t *w, int32_t d) |
virtual const char * | get_name () const |
Protected Member Functions | |
void | compute_normalization_const () |
Protected Attributes | |
CStringFeatures< uint16_t > * | strings |
float64_t * | normalization_factors |
int32_t | num_strings |
int32_t | alphabet_size |
int32_t | degree |
int32_t | spec_size |
float64_t * | spec_weights |
CImplicitWeightedSpecFeatures::CImplicitWeightedSpecFeatures | ( | CStringFeatures< uint16_t > * | str, | |
bool | normalize = true | |||
) |
constructor
str | stringfeatures (of words) | |
normalize | whether to use sqrtdiag normalization |
Definition at line 14 of file ImplicitWeightedSpecFeatures.cpp.
CImplicitWeightedSpecFeatures::CImplicitWeightedSpecFeatures | ( | const CImplicitWeightedSpecFeatures & | orig | ) |
copy constructor
Definition at line 76 of file ImplicitWeightedSpecFeatures.cpp.
CImplicitWeightedSpecFeatures::~CImplicitWeightedSpecFeatures | ( | ) | [virtual] |
Definition at line 84 of file ImplicitWeightedSpecFeatures.cpp.
void CImplicitWeightedSpecFeatures::add_to_dense_vec | ( | float64_t | alpha, | |
int32_t | vec_idx1, | |||
float64_t * | vec2, | |||
int32_t | vec2_len, | |||
bool | abs_val = false | |||
) | [virtual] |
add vector 1 multiplied with alpha to dense vector2
alpha | scalar alpha | |
vec_idx1 | index of first vector | |
vec2 | pointer to real valued vector | |
vec2_len | length of real valued vector | |
abs_val | if true add the absolute value |
Implements CDotFeatures.
Definition at line 180 of file ImplicitWeightedSpecFeatures.cpp.
void CImplicitWeightedSpecFeatures::compute_normalization_const | ( | ) | [protected] |
compute the sqrt diag normalization constant per string
Definition at line 33 of file ImplicitWeightedSpecFeatures.cpp.
float64_t CImplicitWeightedSpecFeatures::dense_dot | ( | int32_t | vec_idx1, | |
const float64_t * | vec2, | |||
int32_t | vec2_len | |||
) | [virtual] |
compute dot product between vector1 and a dense vector
vec_idx1 | index of first vector | |
vec2 | pointer to real valued vector | |
vec2_len | length of real valued vector |
Implements CDotFeatures.
Definition at line 144 of file ImplicitWeightedSpecFeatures.cpp.
float64_t CImplicitWeightedSpecFeatures::dot | ( | int32_t | vec_idx1, | |
int32_t | vec_idx2 | |||
) | [virtual] |
compute dot product between vector1 and vector2, appointed by their indices
vec_idx1 | index of first vector | |
vec_idx2 | index of second vector |
Implements CDotFeatures.
Definition at line 91 of file ImplicitWeightedSpecFeatures.cpp.
CFeatures * CImplicitWeightedSpecFeatures::duplicate | ( | ) | const [virtual] |
duplicate feature object
Implements CFeatures.
Definition at line 209 of file ImplicitWeightedSpecFeatures.cpp.
virtual int32_t CImplicitWeightedSpecFeatures::get_dim_feature_space | ( | ) | [virtual] |
obtain the dimensionality of the feature space
(not mix this up with the dimensionality of the input space, usually obtained via get_num_features())
Implements CDotFeatures.
Definition at line 55 of file ImplicitWeightedSpecFeatures.h.
virtual EFeatureClass CImplicitWeightedSpecFeatures::get_feature_class | ( | ) | [virtual] |
get feature class
Implements CFeatures.
Definition at line 110 of file ImplicitWeightedSpecFeatures.h.
virtual EFeatureType CImplicitWeightedSpecFeatures::get_feature_type | ( | ) | [virtual] |
get feature type
Implements CFeatures.
Definition at line 101 of file ImplicitWeightedSpecFeatures.h.
virtual const char* CImplicitWeightedSpecFeatures::get_name | ( | ) | const [virtual] |
Implements CSGObject.
Definition at line 148 of file ImplicitWeightedSpecFeatures.h.
virtual int32_t CImplicitWeightedSpecFeatures::get_nnz_features_for_vector | ( | int32_t | num | ) | [virtual] |
get number of non-zero features in vector
num | which vector |
Implements CDotFeatures.
Definition at line 91 of file ImplicitWeightedSpecFeatures.h.
virtual int32_t CImplicitWeightedSpecFeatures::get_num_vectors | ( | ) | [virtual] |
get number of strings
Implements CFeatures.
Definition at line 119 of file ImplicitWeightedSpecFeatures.h.
virtual int32_t CImplicitWeightedSpecFeatures::get_size | ( | ) | [virtual] |
get size of one element
Implements CFeatures.
Definition at line 128 of file ImplicitWeightedSpecFeatures.h.
bool CImplicitWeightedSpecFeatures::set_wd_weights | ( | ) |
set weighted degree weights
Definition at line 44 of file ImplicitWeightedSpecFeatures.cpp.
bool CImplicitWeightedSpecFeatures::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 65 of file ImplicitWeightedSpecFeatures.cpp.
int32_t CImplicitWeightedSpecFeatures::alphabet_size [protected] |
size of alphabet
Definition at line 166 of file ImplicitWeightedSpecFeatures.h.
int32_t CImplicitWeightedSpecFeatures::degree [protected] |
degree
Definition at line 169 of file ImplicitWeightedSpecFeatures.h.
use sqrtdiag normalization
Definition at line 162 of file ImplicitWeightedSpecFeatures.h.
int32_t CImplicitWeightedSpecFeatures::num_strings [protected] |
number of strings
Definition at line 164 of file ImplicitWeightedSpecFeatures.h.
int32_t CImplicitWeightedSpecFeatures::spec_size [protected] |
size of k-mer spectrum
Definition at line 171 of file ImplicitWeightedSpecFeatures.h.
float64_t* CImplicitWeightedSpecFeatures::spec_weights [protected] |
weights for each of the subkernels of degree 1...d
Definition at line 174 of file ImplicitWeightedSpecFeatures.h.
CStringFeatures<uint16_t>* CImplicitWeightedSpecFeatures::strings [protected] |
reference to strings
Definition at line 159 of file ImplicitWeightedSpecFeatures.h.