SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Features.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) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Subset support written (W) 2011 Heiko Strathmann
10  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
11  */
12 
13 #ifndef _CFEATURES__H__
14 #define _CFEATURES__H__
15 
16 #include <shogun/lib/common.h>
17 #include <shogun/io/File.h>
18 #include <shogun/base/SGObject.h>
21 #include <shogun/features/Subset.h>
22 
23 namespace shogun
24 {
25  class CFile;
26  class CPreprocessor;
27  class CKernel;
28 }
29 
30 namespace shogun
31 {
32 
56 class CFeatures : public CSGObject
57 {
58  void init();
59 
60  public:
65  CFeatures(int32_t size=0);
66 
68  CFeatures(const CFeatures& orig);
69 
74  CFeatures(CFile* loader);
75 
82  virtual CFeatures* duplicate() const=0;
83 
84  virtual ~CFeatures();
85 
92  virtual EFeatureType get_feature_type()=0;
93 
100  virtual EFeatureClass get_feature_class()=0;
101 
107  virtual int32_t add_preprocessor(CPreprocessor* p);
108 
114  virtual CPreprocessor* del_preprocessor(int32_t num);
115 
120  CPreprocessor* get_preprocessor(int32_t num);
121 
126  void set_preprocessed(int32_t num);
127 
132  bool is_preprocessed(int32_t num);
133 
138  int32_t get_num_preprocessed();
139 
144  int32_t get_num_preprocessors() const;
145 
147  void clean_preprocessors();
148 
153  int32_t get_cache_size();
154 
161  virtual int32_t get_num_vectors() const=0;
162 
171  virtual bool reshape(int32_t num_features, int32_t num_vectors);
172 
179  virtual int32_t get_size()=0;
180 
182  void list_feature_obj();
183 
188  virtual void load(CFile* loader);
189 
194  virtual void save(CFile* writer);
195 
202 
209 
215 
221 
227  virtual void set_subset(CSubset* subset);
228 
231  virtual void remove_subset();
232 
234  virtual void subset_changed_post() {}
235 
242 
246  bool has_subset() const;
247 
257  virtual CFeatures* copy_subset(SGVector<index_t> indices);
258 
259  private:
261  uint64_t properties;
262 
264  int32_t cache_size;
265 
267  CPreprocessor** preproc;
268 
270  int32_t num_preproc;
271 
273  bool* preprocessed;
274 
275  protected:
276 
279 };
280 }
281 #endif

SHOGUN Machine Learning Toolbox - Documentation