SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BinnedDotFeatures.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  * Copyright (C) 2012 Soeren Sonnenburg
8  */
9 
10 #ifndef _BINNED_DOTFEATURES_H___
11 #define _BINNED_DOTFEATURES_H___
12 
13 #include <shogun/lib/config.h>
14 
15 #include <shogun/lib/common.h>
18 
19 namespace shogun
20 {
21  template <class T> class CDenseFeatures;
22 
44 {
45  public:
50  CBinnedDotFeatures(int32_t size=0);
51 
54 
62 
63  virtual ~CBinnedDotFeatures();
64 
72  virtual int32_t get_dim_feature_space() const;
73 
81  virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2);
82 
89  virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len);
90 
99  virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t* vec2, int32_t vec2_len, bool abs_val=false);
100 
108  virtual int32_t get_nnz_features_for_vector(int32_t num);
109 
119  virtual void* get_feature_iterator(int32_t vector_index);
120 
131  virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator);
132 
138  virtual void free_feature_iterator(void* iterator);
139 
140 
145  bool get_fill();
146 
151  void set_fill(bool fill);
152 
157  bool get_norm_one();
158 
163  void set_norm_one(bool norm_one);
164 
170 
176 
186  void set_bins(SGMatrix<float64_t> bins);
187 
193 
197  virtual const char* get_name() const;
198 
203  virtual CFeatures* duplicate() const;
204 
209  virtual EFeatureType get_feature_type() const;
210 
215  virtual EFeatureClass get_feature_class() const;
216 
221  virtual int32_t get_num_vectors() const;
222 
223  private:
224  void init();
225 
230  void assert_shape(int32_t vec2_len);
231 
232  protected:
235 
238 
240  bool m_fill;
241 
244 };
245 }
246 #endif // _BINNED_DOTFEATURES_H___
247 
CDenseFeatures< float64_t > * get_simple_features()
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
void set_norm_one(bool norm_one)
CDenseFeatures< float64_t > * m_features
underlying features
void set_simple_features(CDenseFeatures< float64_t > *features)
Features that support dot products among other operations.
Definition: DotFeatures.h:44
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
virtual EFeatureClass get_feature_class() const
The class BinnedDotFeatures contains a 0-1 conversion of features into bins.
virtual int32_t get_nnz_features_for_vector(int32_t num)
double float64_t
Definition: common.h:50
SGMatrix< float64_t > m_bins
bins with limits
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
void set_bins(SGMatrix< float64_t > bins)
bool m_fill
fill up with 1's or flag just one column
virtual int32_t get_dim_feature_space() const
virtual CFeatures * duplicate() const
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
virtual const char * get_name() const
virtual void free_feature_iterator(void *iterator)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
bool m_norm_one
normalize vectors to have norm one
SGMatrix< float64_t > get_bins()
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)
virtual void * get_feature_iterator(int32_t vector_index)
virtual int32_t get_num_vectors() const
virtual EFeatureType get_feature_type() const

SHOGUN Machine Learning Toolbox - Documentation