SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  * Written (W) 2011-2012 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>
22 #include <shogun/lib/List.h>
25 
26 namespace shogun
27 {
28  class CFile;
29  class CPreprocessor;
30  class CKernel;
31 }
32 
33 namespace shogun
34 {
35 
62 class CFeatures : public CSGObject
63 {
64  public:
69  CFeatures(int32_t size=0);
70 
72  CFeatures(const CFeatures& orig);
73 
78  CFeatures(CFile* loader);
79 
86  virtual CFeatures* duplicate() const=0;
87 
88  virtual ~CFeatures();
89 
96  virtual EFeatureType get_feature_type() const=0;
97 
104  virtual EFeatureClass get_feature_class() const=0;
105 
110  virtual void add_preprocessor(CPreprocessor* p);
111 
116  virtual void del_preprocessor(int32_t num);
117 
122  CPreprocessor* get_preprocessor(int32_t num) const;
123 
128  void set_preprocessed(int32_t num);
129 
134  bool is_preprocessed(int32_t num) const;
135 
140  int32_t get_num_preprocessed() const;
141 
146  int32_t get_num_preprocessors() const;
147 
149  void clean_preprocessors();
150 
152  void list_preprocessors();
153 
158  int32_t get_cache_size() const;
159 
166  virtual int32_t get_num_vectors() const=0;
167 
176  virtual bool reshape(int32_t num_features, int32_t num_vectors);
177 
179  void list_feature_obj() const;
180 
185  virtual void load(CFile* loader);
186 
191  virtual void save(CFile* writer);
192 
198  bool check_feature_compatibility(CFeatures* f) const;
199 
205  bool has_property(EFeatureProperty p) const;
206 
212 
218 
230  {
231  SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
232  return NULL;
233  }
234 
244  {
245  SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
246  return NULL;
247  }
248 
254  virtual void add_subset(SGVector<index_t> subset);
255 
258  virtual void remove_subset();
259 
262  virtual void remove_all_subsets();
263 
268  virtual CSubsetStack* get_subset_stack();
269 
271  virtual void subset_changed_post() {}
272 
282  virtual CFeatures* copy_subset(SGVector<index_t> indices);
283 
284  private:
285  void init();
286 
287  private:
289  uint64_t properties;
290 
292  int32_t cache_size;
293 
295  CDynamicObjectArray* preproc;
296 
298  CDynamicArray<bool>* preprocessed;
299 
300  protected:
303 };
304 }
305 #endif

SHOGUN Machine Learning Toolbox - Documentation