20 init(NULL,
false, 0, 0,
false,
true);
25 bool is_labelled, int32_t size, int32_t d,
bool use_quadr,
bool keep_lin_terms)
27 init(file, is_labelled, size, d, use_quadr, keep_lin_terms);
32 int32_t d,
bool use_quadr,
bool keep_lin_terms,
float64_t* lab)
38 bool is_labelled = (lab != NULL);
41 init(file, is_labelled, size, d, use_quadr, keep_lin_terms);
43 parser.set_free_vectors_on_destruct(
false);
54 int32_t size, int32_t d,
bool use_quadr,
bool keep_lin_terms)
57 use_quadratic = use_quadr;
58 keep_linear_terms = keep_lin_terms;
60 SG_ADD(&use_quadratic,
"use_quadratic",
"Whether to use quadratic features",
62 SG_ADD(&keep_linear_terms,
"keep_linear_terms",
"Whether to keep the linear terms or not",
66 has_labels = is_labelled;
71 parser.init(file, is_labelled, size);
78 parser.set_free_vector_after_release(
false);
100 for (
index_t i=0; i<current_vector.num_feat_entries; i++)
101 result += vec2[current_vector.features[i].feat_index] * current_vector.features[i].entry;
108 int32_t vec2_len,
bool abs_val)
115 for (
index_t i=0; i<current_vector.num_feat_entries; i++)
116 vec2[current_vector.features[i].feat_index] += alpha * current_vector.features[i].entry;
128 return "StreamingHashedDenseFeatures";
170 if (!parser.is_running())
171 parser.start_parser();
183 return current_label;
190 if (parser.get_next_example(tmp.
vector,
191 tmp.
vlen, current_label))
205 parser.finalize_example();
217 return current_vector;
virtual float64_t get_label()
virtual const char * get_name() const =0
virtual void set_vector_and_label_reader()
virtual float32_t dense_dot(const float32_t *vec2, int32_t vec2_len)
The class DenseFeatures implements dense feature matrices.
virtual const char * get_name() const
Class CStreamingFileFromDenseFeatures is a derived class of CStreamingFile which creates an input sou...
virtual bool get_next_example()
virtual int32_t get_dim_feature_space() const
static SGSparseVector< ST > hash_vector(SGVector< ST > vec, int32_t dim, bool use_quadratic=false, bool keep_linear_terms=true)
virtual void get_vector(bool *&vector, int32_t &len)
virtual int32_t get_num_vectors() const
EFeatureClass
shogun feature class
A Streaming File access class.
virtual float32_t dot(CStreamingDotFeatures *df)
This class acts as an alternative to the CStreamingDenseFeatures class and their difference is that t...
virtual void start_parser()
virtual EFeatureClass get_feature_class() const
virtual void release_example()
Streaming features that support dot products among other operations.
virtual void end_parser()
EFeatureType
shogun feature type
virtual ~CStreamingHashedDenseFeatures()
virtual int32_t get_num_features()
virtual void get_vector_and_label(bool *&vector, int32_t &len, float64_t &label)
virtual CFeatures * duplicate() const
all of classes and functions are contained in the shogun namespace
virtual void set_vector_reader()
virtual void add_to_dense_vec(float32_t alpha, float32_t *vec2, int32_t vec2_len, bool abs_val=false)
The class Features is the base class of all feature objects.
CStreamingHashedDenseFeatures()
SGSparseVector< ST > get_vector()
virtual EFeatureType get_feature_type() const
SGSparseVector< ST > current_vector
virtual EFeatureType get_feature_type() const =0