SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StreamingDenseFeatures.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011 Shashwat Lal Das
8  * Written (W) 2012 Heiko Strathmann
9  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
10  */
11 #ifndef _STREAMINGDENSEFEATURES__H__
12 #define _STREAMINGDENSEFEATURES__H__
13 
14 #include <shogun/lib/common.h>
17 #include <shogun/lib/DataType.h>
19 
20 namespace shogun
21 {
28 template<class T> class CStreamingDenseFeatures:
30 {
31 public:
32 
41 
50  CStreamingDenseFeatures(CStreamingFile* file, bool is_labelled,
51  int32_t size);
52 
61  NULL);
62 
69 
79  virtual void set_vector_reader();
80 
90  virtual void set_vector_and_label_reader();
91 
97  virtual void start_parser();
98 
104  virtual void end_parser();
105 
110  virtual void reset_stream();
111 
120  virtual bool get_next_example();
121 
128 
136  virtual float64_t get_label();
137 
144  virtual void release_example();
145 
153  virtual int32_t get_dim_feature_space() const;
154 
162  virtual float32_t dot(SGVector<T> vec);
163 
174  virtual float32_t dot(CStreamingDotFeatures *df);
175 
183  virtual float32_t dense_dot(const float32_t* vec2, int32_t vec2_len);
184 
192  virtual float64_t dense_dot(const float64_t* vec2, int32_t vec2_len);
193 
203  virtual void add_to_dense_vec(float32_t alpha, float32_t* vec2,
204  int32_t vec2_len, bool abs_val=false);
205 
215  virtual void add_to_dense_vec(float64_t alpha, float64_t* vec2,
216  int32_t vec2_len, bool abs_val=false);
217 
222  virtual int32_t get_nnz_features_for_vector();
223 
229  int32_t get_num_features();
230 
236  virtual EFeatureType get_feature_type() const;
237 
243  virtual EFeatureClass get_feature_class() const;
244 
250  virtual CFeatures* duplicate() const;
251 
257  virtual const char* get_name() const
258  {
259  return "StreamingDenseFeatures";
260  }
261 
267  virtual int32_t get_num_vectors() const;
268 
275  virtual CFeatures* get_streamed_features(index_t num_elements);
276 
277 private:
282  void init();
283 
291  void init(CStreamingFile *file, bool is_labelled, int32_t size);
292 
293 protected:
294 
297 
299  CInputParser<T> parser;
300 
303 
306 };
307 }
308 #endif // _STREAMINGDENSEFEATURES__H__

SHOGUN Machine Learning Toolbox - Documentation