SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StreamingDotFeatures.cpp
Go to the documentation of this file.
2 
3 using namespace shogun;
4 
6 {
7  init();
9 }
10 
12  int32_t size) : CStreamingFeatures()
13 {
14  init(file, is_labelled, size);
16 }
17 
19  float64_t* lab)
20 {
22  return;
23 }
24 
26 {
27 }
28 
30  float32_t* vec, int32_t dim, float32_t b, int32_t num_vec)
31 {
32  ASSERT(num_vec>=0);
33 
34  int32_t counter=0;
35  start_parser();
36  while (get_next_example())
37  {
38  if (alphas)
39  output[counter]=alphas[counter]*dense_dot(vec, dim)+b;
40  else
41  output[counter]=dense_dot(vec, dim)+b;
42 
44 
45  counter++;
46  if ((counter>=num_vec) && (num_vec>0))
47  break;
48  }
49  end_parser();
50 }
51 
53 {
54  int32_t dim = get_dim_feature_space();
55  if (dim > len)
56  {
57  vec = SG_REALLOC(float32_t, vec, dim);
58  memset(&vec[len], 0, (dim-len) * sizeof(float32_t));
59  len = dim;
60  }
61 }
62 
64 {
65  int32_t dim = get_dim_feature_space();
66  if (dim > len)
67  {
68  vec = SG_REALLOC(float64_t, vec, dim);
69  memset(&vec[len], 0, (dim-len) * sizeof(float64_t));
70  len = dim;
71  }
72 }
73 
75 {
77  return NULL;
78 }
79 
81 {
83  return -1;
84 }
85 
86 bool CStreamingDotFeatures::get_next_feature(int32_t& index, float32_t& value, void* iterator)
87 {
89  return false;
90 }
91 
93 {
95  return;
96 }
97 
98 void CStreamingDotFeatures::init()
99 {
100 }
101 
102 void CStreamingDotFeatures::init(CStreamingFile *file, bool is_labelled, int32_t size)
103 {
104 }
virtual void start_parser()=0
virtual float32_t dense_dot(const float32_t *vec2, int32_t vec2_len)=0
virtual void free_feature_iterator(void *iterator)
void set_property(EFeatureProperty p)
Definition: Features.cpp:342
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:82
virtual void dense_dot_range(float32_t *output, float32_t *alphas, float32_t *vec, int32_t dim, float32_t b, int32_t num_vec=0)
Features that support dot products among other operations.
Definition: DotFeatures.h:41
virtual bool get_next_feature(int32_t &index, float32_t &value, void *iterator)
A Streaming File access class.
Definition: StreamingFile.h:38
virtual int32_t get_dim_feature_space() const =0
virtual bool get_next_example()=0
#define ASSERT(x)
Definition: SGIO.h:102
double float64_t
Definition: common.h:56
virtual void expand_if_required(float32_t *&vec, int32_t &len)
float float32_t
Definition: common.h:55
#define SG_REALLOC(type, ptr, len)
Definition: memory.h:38
virtual void end_parser()=0
virtual void release_example()=0
Streaming features are features which are used for online algorithms.
virtual int32_t get_nnz_features_for_vector()

SHOGUN Machine Learning Toolbox - Documentation