13 using namespace shogun;
17 SG_UNSTABLE(
"CSparsePolyFeatures::CSparsePolyFeatures()",
71 return vlen*(vlen+1)/2;
132 pf->m_feat->free_feature_vector(vec2, vec_idx2);
155 (uint8_t*)&(vec.
features[i].feat_index),
156 sizeof(int32_t), 0xDEADBEAF);
162 (uint8_t*)&(vec.
features[j].feat_index),
163 sizeof(int32_t), seed)&
mask;
205 (uint8_t*)&(vec.
features[i].feat_index),
sizeof(int32_t),
212 (uint8_t*)&(vec.
features[j].feat_index),
213 sizeof(int32_t), seed)&
mask;
241 for (
int i=0; i<m_normalization_values_len; i++)
258 void CSparsePolyFeatures::init()
261 "Features in original space.");
265 "Dimensions of the input space.");
267 "Dimensions of the feature space of the polynomial kernel.");
270 "m_normalization_values",
"Norm of each training example");
virtual ~CSparsePolyFeatures()
int32_t get_num_features()
CSparseFeatures< float64_t > * m_feat
void free_feature_iterator(void *iterator)
virtual EFeatureType get_feature_type()=0
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)
void free_feature_vector(SGSparseVector< ST > vec, int32_t num)
static ST sparse_dot(ST alpha, SGSparseVectorEntry< ST > *avec, int32_t alen, SGSparseVectorEntry< ST > *bvec, int32_t blen)
int32_t m_output_dimensions
virtual void * get_feature_iterator(int32_t vector_index)
#define SG_NOTIMPLEMENTED
Features that support dot products among other operations.
static uint32_t MurmurHash2(uint8_t *data, int32_t len, uint32_t seed)
EFeatureClass
shogun feature class
virtual int32_t get_dim_feature_space() const
void add(bool *param, const char *name, const char *description="")
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
virtual int32_t get_num_vectors() const
CFeatures * duplicate() const
Class SGObject is the base class of all shogun objects.
virtual EFeatureClass get_feature_class()=0
virtual EFeatureType get_feature_type()
virtual int32_t get_size()
static int32_t pow(int32_t x, int32_t n)
EFeatureType
shogun feature type
float64_t * m_normalization_values
bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
void add_vector(bool **param, index_t *length, const char *name, const char *description="")
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
The class Features is the base class of all feature objects.
int32_t m_input_dimensions
virtual EFeatureClass get_feature_class()
virtual int32_t get_num_vectors() const
implement DotFeatures for the polynomial kernel
static float32_t sqrt(float32_t x)
x^0.5
SGSparseVector< ST > get_sparse_feature_vector(int32_t num)
#define SG_UNSTABLE(func,...)
#define SG_MALLOC(type, len)
static T abs(T a)
return the absolute value of a number
void store_normalization_values()
virtual int32_t get_nnz_features_for_vector(int32_t num)
SGSparseVectorEntry< T > * features