SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RandomKitchenSinksDotFeatures.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 _RANDOMKITCHENSINKS_DOT_FEATURES_H__
12 #define _RANDOMKITCHENSINKS_DOT_FEATURES_H__
13 
14 #include <shogun/lib/config.h>
15 
17 
18 namespace shogun
19 {
20 
51 {
52 public:
53 
56 
64  CRandomKitchenSinksDotFeatures(CDotFeatures* dataset, int32_t K);
65 
72  CRandomKitchenSinksDotFeatures(CDotFeatures* dataset, int32_t K,
73  SGMatrix<float64_t> coeff);
74 
80 
83 
85  virtual CFeatures* duplicate() const;
86 
89 
97  virtual int32_t get_dim_feature_space() const;
98 
108  virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df,
109  int32_t vec_idx2);
110 
119  virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2,
120  int32_t vec2_len);
121 
132  virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1,
133  float64_t* vec2, int32_t vec2_len, bool abs_val = false);
134 
140  virtual int32_t get_nnz_features_for_vector(int32_t num);
141 
153  virtual void* get_feature_iterator(int32_t vector_index);
154 
167  virtual bool get_next_feature(int32_t& index, float64_t& value,
168  void* iterator);
169 
175  virtual void free_feature_iterator(void* iterator);
176 
181  virtual EFeatureType get_feature_type() const;
182 
187  virtual EFeatureClass get_feature_class() const;
188 
193  virtual int32_t get_num_vectors() const;
194 
201 
207 
209  const char* get_name() const;
210 
211 protected:
218  virtual float64_t dot(index_t vec_idx, index_t par_idx);
219 
227  virtual float64_t post_dot(float64_t dot_result, index_t par_idx);
228 
234 private:
235  void init(CDotFeatures* dataset, int32_t K);
236 
237 protected:
238 
241 
243  int32_t num_samples;
244 
247 };
248 }
249 
250 #endif // _RANDOMKITCHENSINKS_DOT_FEATURES_H__
251 
class that implements the Random Kitchen Sinks (RKS) for the DotFeatures as mentioned in http://books...
int32_t index_t
Definition: common.h:62
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
Features that support dot products among other operations.
Definition: DotFeatures.h:44
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
double float64_t
Definition: common.h:50
A File access base class.
Definition: File.h:34
virtual SGVector< float64_t > generate_random_parameter_vector()=0
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
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
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)
virtual void * get_feature_iterator(int32_t vector_index)
virtual float64_t post_dot(float64_t dot_result, index_t par_idx)

SHOGUN Machine Learning Toolbox - Documentation