35 m_str_min(NULL), m_str_maj(NULL)
57 normalization_const(orig.normalization_const),
58 m_str_min(NULL), m_str_maj(NULL)
142 bool free_avec, free_bvec;
145 uint8_t* bvec = sf->strings->get_feature_vector(idx_b, blen, free_bvec);
155 for (int32_t i = 0; i<alen-1; i+=2)
162 uint8_t a2=avec[i+1];
164 uint8_t b2=bvec[i+1];
166 if ((a1!=a2 || a1==
'0' || a1==
'0') && (b1!=b2 || b1==
'0' || b2==
'0'))
168 else if (a1==a2 && b1==b2)
179 SG_ERROR(
"The impossible happened i=%d a1=%c "
184 total+=sumaa+sumbb+sumab;
188 sf->strings->free_feature_vector(bvec, idx_b, free_bvec);
194 if (vec2_len !=
w_dim)
195 SG_ERROR(
"Dimensions don't match, vec2_dim=%d, w_dim=%d\n", vec2_len,
w_dim)
203 for (int32_t i=0; i<len; i+=2)
210 if (a1==a2 && a1!=
'0' && a2!=
'0')
218 SG_ERROR(
"The impossible happened i=%d a1=%c a2=%c min=%c maj=%c\n",
233 if (vec2_len !=
w_dim)
234 SG_ERROR(
"Dimensions don't match, vec2_dim=%d, w_dim=%d\n", vec2_len,
w_dim)
244 for (int32_t i=0; i<len; i+=2)
251 if (a1==a2 && a1!=
'0' && a2!=
'0')
259 SG_ERROR(
"The impossible happened i=%d a1=%c a2=%c min=%c maj=%c\n",
264 vec2[offs+dim]+=alpha;
270 void CSNPFeatures::find_minor_major_strings(uint8_t* minor, uint8_t* major)
279 for (int32_t j=0; j<len; j++)
287 else if (major[j]==0 && vec[j]!=minor[j])
362 for (int32_t i=0; i<num_str; i++)
368 for (int32_t j=0; j<len; j+=2)
375 if (a1==a2 && a1!=
'0' && a2!=
'0')
383 SG_ERROR(
"The impossible happened j=%d a1=%c a2=%c min=%c maj=%c\n",
388 h[int64_t(j/2)*nsym+dim]++;
399 for (int32_t j=0; j<nsym; j++)
401 if (h_normalizer && h_normalizer[i])
402 h[int64_t(i)*nsym+j]/=h_normalizer[i];
406 SG_FREE(h_normalizer);
423 for (int32_t i=0; i<3*len/2; i++)
425 table[2*i]=p_hist.
matrix[i];
426 table[2*i+1]=n_hist.
matrix[i];
virtual int32_t get_max_vector_length()
SGVector< ST > get_feature_vector(int32_t num)
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 void free_feature_iterator(void *iterator)
virtual int32_t get_num_vectors() const
float64_t get_normalization_const()
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
virtual int32_t get_nnz_features_for_vector(int32_t num)
EAlphabet get_alphabet() const
void set_major_base_string(const char *str)
virtual int32_t get_num_vectors() const
The class Alphabet implements an alphabet and alphabet utility functions.
void obtain_base_strings(CSNPFeatures *snp=NULL)
virtual int32_t get_dim_feature_space() const
void free_feature_vector(ST *feat_vec, int32_t num, bool dofree)
char * get_major_base_string()
Features that support dot products among other operations.
virtual void * get_feature_iterator(int32_t vector_index)
EFeatureClass
shogun feature class
virtual EFeatureType get_feature_type() const
char * get_minor_base_string()
virtual CFeatures * duplicate() const
virtual EFeatureClass get_feature_class() const =0
CAlphabet * get_alphabet()
EFeatureType
shogun feature type
bool have_same_length(int32_t len=-1)
CStringFeatures< uint8_t > * strings
float64_t normalization_const
Features that compute the Weighted Degreee Kernel feature space explicitly.
all of classes and functions are contained in the shogun namespace
void set_minor_base_string(const char *str)
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
virtual SGMatrix< float64_t > get_histogram(bool normalize=true)
The class Features is the base class of all feature objects.
static void swap(T &a, T &b)
void set_normalization_const(float64_t n=0)
static SGMatrix< float64_t > get_2x3_table(CSNPFeatures *pos, CSNPFeatures *neg)
static float32_t sqrt(float32_t x)
virtual EFeatureClass get_feature_class() const
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)
#define SG_UNSTABLE(func,...)
virtual EFeatureType get_feature_type() const =0