SHOGUN  3.2.1
 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/config.h>
17 
18 #include <shogun/lib/common.h>
19 #include <shogun/io/File.h>
20 #include <shogun/base/SGObject.h>
24 #include <shogun/lib/List.h>
27 
28 namespace shogun
29 {
30  class CFile;
31  class CPreprocessor;
32  class CKernel;
33 }
34 
35 namespace shogun
36 {
37 
68 class CFeatures : public CSGObject
69 {
70  public:
75  CFeatures(int32_t size=0);
76 
78  CFeatures(const CFeatures& orig);
79 
84  CFeatures(CFile* loader);
85 
92  virtual CFeatures* duplicate() const=0;
93 
94  virtual ~CFeatures();
95 
102  virtual EFeatureType get_feature_type() const=0;
103 
110  virtual EFeatureClass get_feature_class() const=0;
111 
116  virtual void add_preprocessor(CPreprocessor* p);
117 
122  virtual void del_preprocessor(int32_t num);
123 
128  CPreprocessor* get_preprocessor(int32_t num) const;
129 
134  void set_preprocessed(int32_t num);
135 
140  bool is_preprocessed(int32_t num) const;
141 
146  int32_t get_num_preprocessed() const;
147 
152  int32_t get_num_preprocessors() const;
153 
155  void clean_preprocessors();
156 
158  void list_preprocessors();
159 
164  int32_t get_cache_size() const;
165 
172  virtual int32_t get_num_vectors() const=0;
173 
182  virtual bool reshape(int32_t num_features, int32_t num_vectors);
183 
185  void list_feature_obj() const;
186 
191  virtual void load(CFile* loader);
192 
197  virtual void save(CFile* writer);
198 
204  bool check_feature_compatibility(CFeatures* f) const;
205 
211  bool has_property(EFeatureProperty p) const;
212 
218 
224 
236  {
237  SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
238  return NULL;
239  }
240 
250  {
251  SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
252  return NULL;
253  }
254 
265  virtual void add_subset(SGVector<index_t> subset);
266 
276  virtual void add_subset_in_place(SGVector<index_t> subset);
277 
280  virtual void remove_subset();
281 
284  virtual void remove_all_subsets();
285 
290  virtual CSubsetStack* get_subset_stack();
291 
293  virtual void subset_changed_post() {}
294 
304  virtual CFeatures* copy_subset(SGVector<index_t> indices);
305 
306  private:
307  void init();
308 
309  private:
311  uint64_t properties;
312 
314  int32_t cache_size;
315 
317  CDynamicObjectArray* preproc;
318 
320  CDynamicArray<bool>* preprocessed;
321 
322  protected:
325 };
326 }
327 #endif

SHOGUN Machine Learning Toolbox - Documentation