SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Features.h
浏览该文件的文档.
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
CSubsetStack * m_subset_stack
Definition: Features.h:302
virtual void save(CFile *writer)
Definition: Features.cpp:273
virtual bool reshape(int32_t num_features, int32_t num_vectors)
Definition: Features.cpp:162
void set_preprocessed(int32_t num)
Definition: Features.cpp:140
CFeatures(int32_t size=0)
Definition: Features.cpp:23
virtual int32_t get_num_vectors() const =0
void set_property(EFeatureProperty p)
Definition: Features.cpp:297
#define SG_ERROR(...)
Definition: SGIO.h:131
CPreprocessor * get_preprocessor(int32_t num) const
Definition: Features.cpp:90
virtual CFeatures * duplicate() const =0
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:35
class to add subset support to another class. A CSubsetStackStack instance should be added and wrappe...
Definition: SubsetStack.h:35
virtual CFeatures * create_merged_copy(CFeatures *other)
Definition: Features.h:243
int32_t get_num_preprocessors() const
Definition: Features.cpp:152
virtual CFeatures * create_merged_copy(CList *others)
Definition: Features.h:229
virtual void del_preprocessor(int32_t num)
Definition: Features.cpp:119
virtual void subset_changed_post()
Definition: Features.h:271
bool check_feature_compatibility(CFeatures *f) const
Definition: Features.cpp:280
void list_feature_obj() const
Definition: Features.cpp:168
virtual CSubsetStack * get_subset_stack()
Definition: Features.cpp:325
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
void unset_property(EFeatureProperty p)
Definition: Features.cpp:302
bool is_preprocessed(int32_t num) const
Definition: Features.cpp:146
A File access base class.
Definition: File.h:34
virtual EFeatureClass get_feature_class() const =0
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
virtual void load(CFile *loader)
Definition: Features.cpp:266
EFeatureType
shogun feature type
Definition: FeatureTypes.h:16
virtual void add_preprocessor(CPreprocessor *p)
Definition: Features.cpp:82
virtual void remove_subset()
Definition: Features.cpp:313
int32_t get_num_preprocessed() const
Definition: Features.cpp:100
int32_t get_cache_size() const
Definition: Features.cpp:157
virtual CFeatures * copy_subset(SGVector< index_t > indices)
Definition: Features.cpp:330
The class Features is the base class of all feature objects.
Definition: Features.h:62
Class Preprocessor defines a preprocessor interface.
Definition: Preprocessor.h:69
virtual ~CFeatures()
Definition: Features.cpp:50
void clean_preprocessors()
Definition: Features.cpp:113
bool has_property(EFeatureProperty p) const
Definition: Features.cpp:292
virtual void remove_all_subsets()
Definition: Features.cpp:319
EFeatureProperty
shogun feature properties
Definition: FeatureTypes.h:60
void list_preprocessors()
Definition: Features.cpp:128
virtual void add_subset(SGVector< index_t > subset)
Definition: Features.cpp:307
virtual EFeatureType get_feature_type() const =0
Class List implements a doubly connected list for low-level-objects.
Definition: List.h:82

SHOGUN 机器学习工具包 - 项目文档