SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DirectorDotFeatures.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 _DIRECTORDOTFEATURES_H___
11 #define _DIRECTORDOTFEATURES_H___
12 
13 #include <shogun/lib/config.h>
14 
15 #ifdef USE_SWIG_DIRECTORS
16 #include <shogun/lib/common.h>
19 
20 namespace shogun
21 {
24 #define IGNORE_IN_CLASSLIST
25 IGNORE_IN_CLASSLIST class CDirectorDotFeatures : public CDotFeatures
26 {
27  public:
28 
33  CDirectorDotFeatures(int32_t size=0) : CDotFeatures(size)
34  {
35  }
36 
37  virtual ~CDirectorDotFeatures() { }
38 
45  virtual int32_t get_num_vectors() const
46  {
48  return 0;
49  }
50 
51 
59  virtual int32_t get_dim_feature_space() const
60  {
62  return 0;
63  }
64 
72  virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2)
73  {
75  return 0;
76  }
77 
83  virtual float64_t dense_dot_sgvec(int32_t vec_idx1, const SGVector<float64_t> vec2)
84  {
86  return 0;
87  }
88 
97  virtual void add_to_dense_sgvec(float64_t alpha, int32_t vec_idx1, SGVector<float64_t> vec2, bool abs_val=false)
98  {
100  }
101 
108  virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len)
109  {
110  return dense_dot_sgvec(vec_idx1, SGVector<float64_t>((float64_t*) vec2, vec2_len, false));
111  }
112 
121  virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t* vec2, int32_t vec2_len, bool abs_val=false)
122  {
123  add_to_dense_sgvec(alpha, vec_idx1, SGVector<float64_t>(vec2, vec2_len, false), abs_val);
124  }
125 
139  virtual void dense_dot_range(float64_t* output, int32_t start, int32_t stop, float64_t* alphas, float64_t* vec, int32_t dim, float64_t b)
140  {
141  CDotFeatures::dense_dot_range(output, start, stop, alphas, vec, dim, b);
142  }
143 
155  virtual void dense_dot_range_subset(int32_t* sub_index, int32_t num,
156  float64_t* output, float64_t* alphas, float64_t* vec, int32_t dim, float64_t b)
157  {
158  CDotFeatures::dense_dot_range_subset(sub_index, num, output, alphas, vec, dim, b);
159  }
160 
168  virtual int32_t get_nnz_features_for_vector(int32_t num)
169  {
171  return 0;
172  }
173 
183  virtual void* get_feature_iterator(int32_t vector_index)
184  {
186  return NULL;
187  }
188 
199  virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator)
200  {
202  return false;
203  }
204 
210  virtual void free_feature_iterator(void* iterator)
211  {
213  }
214 
219  virtual SGVector<float64_t> get_mean()
220  {
221  return CDotFeatures::get_mean();
222  }
223 
228  virtual SGMatrix<float64_t> get_cov()
229  {
230  return CDotFeatures::get_cov();
231  }
232 
239  virtual EFeatureType get_feature_type() const
240  {
241  return F_ANY;
242  }
243 
250  virtual CFeatures* duplicate() const
251  {
253  return NULL;
254  }
255 
262  virtual EFeatureClass get_feature_class() const
263  {
264  return C_DIRECTOR_DOT;
265  }
266 
271  virtual void add_preprocessor(CPreprocessor* p)
272  {
274  }
275 
281  virtual void del_preprocessor(int32_t num)
282  {
284  }
285 
294  virtual bool reshape(int32_t num_features, int32_t num_vectors)
295  {
297  return false;
298  }
299 
304  virtual void load(CFile* loader)
305  {
306  CFeatures::load(loader);
307  }
308 
313  virtual void save(CFile* writer)
314  {
315  CFeatures::save(writer);
316  }
317 
323  virtual void add_subset(SGVector<index_t> subset)
324  {
325  CFeatures::add_subset(subset);
326  }
327 
330  virtual void remove_subset()
331  {
333  }
334 
337  virtual void remove_all_subsets()
338  {
340  }
341 
343  virtual void subset_changed_post()
344  {
346  }
347 
357  virtual CFeatures* copy_subset(SGVector<index_t> indices)
358  {
359  return CFeatures::copy_subset(indices);
360  }
361 
363  virtual const char* get_name() const { return "DirectorDotFeatures"; }
364 };
365 }
366 #endif // USE_SWIG_DIRECTORS
367 #endif // _DIRECTORDOTFEATURES_H___
virtual void dense_dot_range(float64_t *output, int32_t start, int32_t stop, float64_t *alphas, float64_t *vec, int32_t dim, float64_t b)
Definition: DotFeatures.cpp:67
virtual void save(CFile *writer)
Definition: Features.cpp:276
Vector::Scalar dot(Vector a, Vector b)
Definition: Redux.h:56
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:139
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
virtual SGVector< float64_t > get_mean()
virtual void del_preprocessor(int32_t num)
Definition: Features.cpp:122
virtual void subset_changed_post()
Definition: Features.h:293
virtual void dense_dot_range_subset(int32_t *sub_index, int32_t num, float64_t *output, float64_t *alphas, float64_t *vec, int32_t dim, float64_t b)
double float64_t
Definition: common.h:50
virtual void load(CFile *loader)
Definition: Features.cpp:269
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
virtual void add_preprocessor(CPreprocessor *p)
Definition: Features.cpp:85
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
#define IGNORE_IN_CLASSLIST
Definition: CPLEXSVM.h:24
virtual void remove_subset()
Definition: Features.cpp:322
virtual CFeatures * copy_subset(SGVector< index_t > indices)
Definition: Features.cpp:340
virtual void remove_all_subsets()
Definition: Features.cpp:328
virtual void add_subset(SGVector< index_t > subset)
Definition: Features.cpp:310
virtual SGMatrix< float64_t > get_cov()

SHOGUN Machine Learning Toolbox - Documentation