SHOGUN  3.2.1
 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/config.h>
15 
16 #include <shogun/lib/common.h>
19 #include <shogun/lib/DataType.h>
21 
22 namespace shogun
23 {
30 template<class T> class CStreamingDenseFeatures:
32 {
33 public:
34 
43 
52  CStreamingDenseFeatures(CStreamingFile* file, bool is_labelled,
53  int32_t size);
54 
63  NULL);
64 
71 
81  virtual void set_vector_reader();
82 
92  virtual void set_vector_and_label_reader();
93 
99  virtual void start_parser();
100 
106  virtual void end_parser();
107 
112  virtual void reset_stream();
113 
122  virtual bool get_next_example();
123 
130 
138  virtual float64_t get_label();
139 
146  virtual void release_example();
147 
155  virtual int32_t get_dim_feature_space() const;
156 
164  virtual float32_t dot(SGVector<T> vec);
165 
176  virtual float32_t dot(CStreamingDotFeatures *df);
177 
185  virtual float32_t dense_dot(const float32_t* vec2, int32_t vec2_len);
186 
194  virtual float64_t dense_dot(const float64_t* vec2, int32_t vec2_len);
195 
205  virtual void add_to_dense_vec(float32_t alpha, float32_t* vec2,
206  int32_t vec2_len, bool abs_val=false);
207 
217  virtual void add_to_dense_vec(float64_t alpha, float64_t* vec2,
218  int32_t vec2_len, bool abs_val=false);
219 
224  virtual int32_t get_nnz_features_for_vector();
225 
231  int32_t get_num_features();
232 
238  virtual EFeatureType get_feature_type() const;
239 
245  virtual EFeatureClass get_feature_class() const;
246 
252  virtual CFeatures* duplicate() const;
253 
259  virtual const char* get_name() const
260  {
261  return "StreamingDenseFeatures";
262  }
263 
269  virtual int32_t get_num_vectors() const;
270 
277  virtual CFeatures* get_streamed_features(index_t num_elements);
278 
279 private:
284  void init();
285 
293  void init(CStreamingFile *file, bool is_labelled, int32_t size);
294 
295 protected:
296 
299 
301  CInputParser<T> parser;
302 
305 
308 };
309 }
310 #endif // _STREAMINGDENSEFEATURES__H__

SHOGUN Machine Learning Toolbox - Documentation