24 parser.set_free_vector_after_release(
false);
29 bool is_labelled, int32_t size) :
32 init(file, is_labelled, size);
34 parser.set_free_vector_after_release(
false);
41 REQUIRE(dense_features,
"%s::CStreamingDenseFeatures(): Features needed!\n")
49 init(file, is_labelled, size);
51 parser.set_free_vector_after_release(
false);
52 parser.set_free_vectors_on_destruct(
false);
74 parser.set_free_vector_after_release(
false);
75 parser.set_free_vectors_on_destruct(
false);
160 #define GET_FEATURE_TYPE(f_type, sg_type) \ 161 template<> EFeatureType CStreamingDenseFeatures<sg_type>::get_feature_type() const \ 179 #undef GET_FEATURE_TYPE 182 void CStreamingDenseFeatures<T>::init()
195 void CStreamingDenseFeatures<T>::init(CStreamingFile* file,
bool is_labelled,
202 parser.init(file, is_labelled, size);
248 parser.finalize_example();
278 "Lengths %d and %d not equal while computing dot product!\n", len1,
current_vector.vlen);
300 SG_DEBUG(
"Streaming %d elements\n", num_elements)
302 REQUIRE(num_elements>0,
"Requested number of feature vectors (%d) must be " 303 "positive\n", num_elements);
308 for (
index_t i=0; i<num_elements; ++i)
313 SG_WARNING(
"Ran out of streaming data, reallocating matrix and " 331 SG_DEBUG(
"Allocating %dx%d matrix\n",
341 "Dimension of streamed vector (%d) does not match " 342 "dimensions of previous vectors (%d)\n",
virtual int32_t get_dim_feature_space() const
virtual CFeatures * get_streamed_features(index_t num_elements)
virtual EFeatureType get_feature_type() const =0
Class CStreamingFileFromDenseFeatures is a derived class of CStreamingFile which creates an input sou...
This class implements streaming features with dense feature vectors.
SGVector< T > get_vector()
bool has_labels
Whether examples are labelled or not.
virtual void add_to_dense_vec(float32_t alpha, float32_t *vec2, int32_t vec2_len, bool abs_val=false)
virtual void get_vector(bool *&vector, int32_t &len)
SGVector< T > current_vector
The current example's feature vector as an SGVector<T>
#define GET_FEATURE_TYPE(f_type, sg_type)
virtual bool get_next_example()
virtual void reset_stream()
virtual float32_t dense_dot(const float32_t *vec2, int32_t vec2_len)
virtual EFeatureClass get_feature_class() const
CStreamingFile * working_file
The StreamingFile object to read from.
EFeatureClass
shogun feature class
A Streaming File access class.
virtual void set_vector_and_label_reader()
CInputParser< T > parser
The parser object, which reads from input and returns parsed example objects.
virtual void set_vector_reader()
virtual float32_t dot(SGVector< T > vec)
virtual void release_example()
virtual const char * get_name() const
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
Compute dot product between v1 and v2 (blas optimized)
Streaming features that support dot products among other operations.
float64_t current_label
The current example's label.
virtual EFeatureClass get_feature_class() const =0
virtual void end_parser()
virtual void get_vector_and_label(bool *&vector, int32_t &len, float64_t &label)
all of classes and functions are contained in the shogun namespace
~CStreamingDenseFeatures()
void set_read_functions()
bool seekable
Whether the stream is seekable.
The class Features is the base class of all feature objects.
int32_t get_num_features()
CStreamingDenseFeatures()
virtual int32_t get_num_vectors() const
virtual void start_parser()
virtual int32_t get_nnz_features_for_vector()
virtual float64_t get_label()
virtual EFeatureType get_feature_type() const