CImplicitWeightedSpecFeatures Class Reference


Detailed Description

Features that compute the Weighted Spectrum Kernel feature space explicitly.

See also:
CWeightedCommWordStringKernel

Definition at line 29 of file ImplicitWeightedSpecFeatures.h.

Inheritance diagram for CImplicitWeightedSpecFeatures:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CImplicitWeightedSpecFeatures (CStringFeatures< uint16_t > *str, bool normalize=true)
 CImplicitWeightedSpecFeatures (const CImplicitWeightedSpecFeatures &orig)
virtual ~CImplicitWeightedSpecFeatures ()
virtual CFeaturesduplicate () 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_tnormalization_factors
int32_t num_strings
int32_t alphabet_size
int32_t degree
int32_t spec_size
float64_tspec_weights

Constructor & Destructor Documentation

CImplicitWeightedSpecFeatures ( CStringFeatures< uint16_t > *  str,
bool  normalize = true 
)

constructor

Parameters:
str stringfeatures (of words)
normalize whether to use sqrtdiag normalization

Definition at line 16 of file ImplicitWeightedSpecFeatures.cpp.

copy constructor

Definition at line 78 of file ImplicitWeightedSpecFeatures.cpp.

~CImplicitWeightedSpecFeatures (  )  [virtual]

Definition at line 86 of file ImplicitWeightedSpecFeatures.cpp.


Member Function Documentation

void 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

Parameters:
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 190 of file ImplicitWeightedSpecFeatures.cpp.

void compute_normalization_const (  )  [protected]

compute the sqrt diag normalization constant per string

See also:
CSqrtDiagKernelNormalization

Definition at line 35 of file ImplicitWeightedSpecFeatures.cpp.

float64_t dense_dot ( int32_t  vec_idx1,
const float64_t vec2,
int32_t  vec2_len 
) [virtual]

compute dot product between vector1 and a dense vector

Parameters:
vec_idx1 index of first vector
vec2 pointer to real valued vector
vec2_len length of real valued vector

Implements CDotFeatures.

Definition at line 151 of file ImplicitWeightedSpecFeatures.cpp.

float64_t dot ( int32_t  vec_idx1,
int32_t  vec_idx2 
) [virtual]

compute dot product between vector1 and vector2, appointed by their indices

Parameters:
vec_idx1 index of first vector
vec_idx2 index of second vector

Implements CDotFeatures.

Definition at line 93 of file ImplicitWeightedSpecFeatures.cpp.

CFeatures * duplicate (  )  const [virtual]

duplicate feature object

Returns:
feature object

Implements CFeatures.

Definition at line 222 of file ImplicitWeightedSpecFeatures.cpp.

virtual int32_t 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())

Returns:
dimensionality

Implements CDotFeatures.

Definition at line 58 of file ImplicitWeightedSpecFeatures.h.

virtual EFeatureClass get_feature_class (  )  [virtual]

get feature class

Returns:
feature class

Implements CFeatures.

Definition at line 113 of file ImplicitWeightedSpecFeatures.h.

virtual EFeatureType get_feature_type (  )  [virtual]

get feature type

Returns:
templated feature type

Implements CFeatures.

Definition at line 104 of file ImplicitWeightedSpecFeatures.h.

virtual const char* get_name (  )  const [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 151 of file ImplicitWeightedSpecFeatures.h.

virtual int32_t get_nnz_features_for_vector ( int32_t  num  )  [virtual]

get number of non-zero features in vector

Parameters:
num which vector
Returns:
number of non-zero features in vector

Implements CDotFeatures.

Definition at line 94 of file ImplicitWeightedSpecFeatures.h.

virtual int32_t get_num_vectors (  )  [virtual]

get number of strings

Returns:
number of strings

Implements CFeatures.

Definition at line 122 of file ImplicitWeightedSpecFeatures.h.

virtual int32_t get_size (  )  [virtual]

get size of one element

Returns:
size of one element

Implements CFeatures.

Definition at line 131 of file ImplicitWeightedSpecFeatures.h.

bool set_wd_weights (  ) 

set weighted degree weights

Returns:
if setting was successful

Definition at line 46 of file ImplicitWeightedSpecFeatures.cpp.

bool set_weights ( float64_t w,
int32_t  d 
)

set custom weights (swig compatible)

Parameters:
w weights
d degree (must match number of weights)
Returns:
if setting was successful

Definition at line 67 of file ImplicitWeightedSpecFeatures.cpp.


Member Data Documentation

int32_t alphabet_size [protected]

size of alphabet

Definition at line 169 of file ImplicitWeightedSpecFeatures.h.

int32_t degree [protected]

degree

Definition at line 172 of file ImplicitWeightedSpecFeatures.h.

use sqrtdiag normalization

Definition at line 165 of file ImplicitWeightedSpecFeatures.h.

int32_t num_strings [protected]

number of strings

Definition at line 167 of file ImplicitWeightedSpecFeatures.h.

int32_t spec_size [protected]

size of k-mer spectrum

Definition at line 174 of file ImplicitWeightedSpecFeatures.h.

float64_t* spec_weights [protected]

weights for each of the subkernels of degree 1...d

Definition at line 177 of file ImplicitWeightedSpecFeatures.h.

CStringFeatures<uint16_t>* strings [protected]

reference to strings

Definition at line 162 of file ImplicitWeightedSpecFeatures.h.


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

SHOGUN Machine Learning Toolbox - Documentation