SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StreamingHashedDenseFeatures.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) 2013 Evangelos Anagnostopoulos
8  * Copyright (C) 2013 Evangelos Anagnostopoulos
9  */
10 
11 #ifndef _STREAMING_HASHED_DENSEFEATURES__H__
12 #define _STREAMING_HASHED_DENSEFEATURES__H__
13 
17 
18 namespace shogun
19 {
20 class CStreamingDotFeatures;
21 
30 template <class ST> class CStreamingHashedDenseFeatures : public CStreamingDotFeatures
31 {
32 public:
35 
46  CStreamingHashedDenseFeatures(CStreamingFile* file, bool is_labelled, int32_t size,
47  int32_t d = 512, bool use_quadr = false, bool keep_lin_terms = true);
48 
64  CStreamingHashedDenseFeatures(CDenseFeatures<ST>* dot_features, int32_t d = 512,
65  bool use_quadr = false, bool keep_lin_terms = true, float64_t* lab = NULL);
66 
69 
76  virtual float32_t dot(CStreamingDotFeatures* df);
77 
83  virtual float32_t dense_dot(const float32_t* vec2, int32_t vec2_len);
84 
92  virtual void add_to_dense_vec(float32_t alpha, float32_t* vec2,
93  int32_t vec2_len, bool abs_val = false);
94 
102  virtual int32_t get_dim_feature_space() const;
103 
109  virtual const char* get_name() const;
110 
116  virtual int32_t get_num_vectors() const;
117 
123  virtual CFeatures* duplicate() const;
124 
134  virtual void set_vector_reader();
135 
145  virtual void set_vector_and_label_reader();
146 
152  virtual EFeatureType get_feature_type() const;
153 
159  virtual EFeatureClass get_feature_class() const;
160 
165  virtual void start_parser();
166 
170  virtual void end_parser();
171 
179  virtual float64_t get_label();
180 
186  virtual bool get_next_example();
187 
193  virtual void release_example();
194 
200  virtual int32_t get_num_features();
201 
207 
208 private:
209  void init(CStreamingFile* file, bool is_labelled, int32_t size,
210  int32_t d, bool use_quadr, bool keep_lin_terms);
211 
212 protected:
213 
215  int32_t dim;
216 
219 
221  CInputParser<ST> parser;
222 
225 
228 
231 };
232 }
233 
234 #endif // _STREAMING_HASHED_DENSEFEATURES__H__

SHOGUN Machine Learning Toolbox - Documentation