SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Features.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2009 Soeren Sonnenburg
00008  * Written (W) 1999-2008 Gunnar Raetsch
00009  * Written (W) 2011-2012 Heiko Strathmann
00010  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00011  */
00012 
00013 #ifndef _CFEATURES__H__
00014 #define _CFEATURES__H__
00015 
00016 #include <shogun/lib/common.h>
00017 #include <shogun/io/File.h>
00018 #include <shogun/base/SGObject.h>
00019 #include <shogun/preprocessor/Preprocessor.h>
00020 #include <shogun/features/FeatureTypes.h>
00021 #include <shogun/features/SubsetStack.h>
00022 #include <shogun/lib/List.h>
00023 #include <shogun/lib/DynamicObjectArray.h>
00024 #include <shogun/lib/DynamicArray.h>
00025 
00026 namespace shogun
00027 {
00028     class CFile;
00029     class CPreprocessor;
00030     class CKernel;
00031 }
00032 
00033 namespace shogun
00034 {
00035 
00062 class CFeatures : public CSGObject
00063 {
00064     public:
00069         CFeatures(int32_t size=0);
00070 
00072         CFeatures(const CFeatures& orig);
00073 
00078         CFeatures(CFile* loader);
00079 
00086         virtual CFeatures* duplicate() const=0;
00087 
00088         virtual ~CFeatures();
00089 
00096         virtual EFeatureType get_feature_type() const=0;
00097 
00104         virtual EFeatureClass get_feature_class() const=0;
00105 
00110         virtual void add_preprocessor(CPreprocessor* p);
00111 
00116         virtual void del_preprocessor(int32_t num);
00117 
00122         CPreprocessor* get_preprocessor(int32_t num) const;
00123 
00128         void set_preprocessed(int32_t num);
00129 
00134         bool is_preprocessed(int32_t num) const;
00135 
00140         int32_t get_num_preprocessed() const;
00141 
00146         int32_t get_num_preprocessors() const;
00147 
00149         void clean_preprocessors();
00150 
00152         void list_preprocessors();
00153 
00158         int32_t get_cache_size() const;
00159 
00166         virtual int32_t get_num_vectors() const=0;
00167 
00176         virtual bool reshape(int32_t num_features, int32_t num_vectors);
00177 
00179         void list_feature_obj() const;
00180 
00185         virtual void load(CFile* loader);
00186 
00191         virtual void save(CFile* writer);
00192 
00198         bool check_feature_compatibility(CFeatures* f) const;
00199 
00205         bool has_property(EFeatureProperty p) const;
00206 
00211         void set_property(EFeatureProperty p);
00212 
00217         void unset_property(EFeatureProperty p);
00218 
00229         virtual CFeatures* create_merged_copy(CList* others)
00230         {
00231             SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
00232             return NULL;
00233         }
00234 
00243         virtual CFeatures* create_merged_copy(CFeatures* other)
00244         {
00245             SG_ERROR("%s::create_merged_copy() is not yet implemented!\n")
00246             return NULL;
00247         }
00248 
00254         virtual void add_subset(SGVector<index_t> subset);
00255 
00258         virtual void remove_subset();
00259 
00262         virtual void remove_all_subsets();
00263 
00268         virtual CSubsetStack* get_subset_stack();
00269 
00271         virtual void subset_changed_post() {}
00272 
00282         virtual CFeatures* copy_subset(SGVector<index_t> indices);
00283 
00284     private:
00285         void init();
00286 
00287     private:
00289         uint64_t  properties;
00290 
00292         int32_t cache_size;
00293 
00295         CDynamicObjectArray* preproc;
00296 
00298         CDynamicArray<bool>* preprocessed;
00299 
00300     protected:
00302         CSubsetStack* m_subset_stack;
00303 };
00304 }
00305 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation