SHOGUN  v2.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>
23 
24 namespace shogun
25 {
26  class CFile;
27  class CPreprocessor;
28  class CKernel;
29 }
30 
31 namespace shogun
32 {
33 
60 class CFeatures : public CSGObject
61 {
62  public:
67  CFeatures(int32_t size=0);
68 
70  CFeatures(const CFeatures& orig);
71 
76  CFeatures(CFile* loader);
77 
84  virtual CFeatures* duplicate() const=0;
85 
86  virtual ~CFeatures();
87 
94  virtual EFeatureType get_feature_type() const=0;
95 
102  virtual EFeatureClass get_feature_class() const=0;
103 
109  virtual int32_t add_preprocessor(CPreprocessor* p);
110 
116  virtual CPreprocessor* 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 
155  int32_t get_cache_size() const;
156 
163  virtual int32_t get_num_vectors() const=0;
164 
173  virtual bool reshape(int32_t num_features, int32_t num_vectors);
174 
181  virtual int32_t get_size() const=0;
182 
184  void list_feature_obj() const;
185 
190  virtual void load(CFile* loader);
191 
196  virtual void save(CFile* writer);
197 
203  bool check_feature_compatibility(CFeatures* f) const;
204 
210  bool has_property(EFeatureProperty p) const;
211 
217 
223 
235  {
236  SG_ERROR("%s::create_merged_copy() is not yet implemented!\n");
237  return NULL;
238  }
239 
245  virtual void add_subset(SGVector<index_t> subset);
246 
249  virtual void remove_subset();
250 
253  virtual void remove_all_subsets();
254 
259  virtual CSubsetStack* get_subset_stack();
260 
262  virtual void subset_changed_post() {}
263 
273  virtual CFeatures* copy_subset(SGVector<index_t> indices);
274 
275  private:
276  void init();
277 
278  private:
280  uint64_t properties;
281 
283  int32_t cache_size;
284 
286  CPreprocessor** preproc;
287 
289  int32_t num_preproc;
290 
292  bool* preprocessed;
293 
294  protected:
297 };
298 }
299 #endif

SHOGUN Machine Learning Toolbox - Documentation