The class Features is the base class of all feature objects.
It can be understood as a dense real valued feature matrix (with e.g. columns as single feature vectors), a set of strings, graphs or any other arbitrary collection of objects. As a result this class is kept very general and implements only very weak interfaces to
In addition it provides helpers to check e.g. for compability of feature objects.
Currently there are 3 general feature classes, which are CSimpleFeatures (dense matrices), CSparseFeatures (sparse matrices), CStringFeatures (a set of strings) from which all the specific features like CSimpleFeatures<float64_t> (dense real valued feature matrices) are derived.
Definition at line 53 of file Features.h.
Public Member Functions | |
CFeatures (int32_t size=0) | |
CFeatures (const CFeatures &orig) | |
CFeatures (CFile *loader) | |
virtual CFeatures * | duplicate () const =0 |
virtual | ~CFeatures () |
virtual EFeatureType | get_feature_type ()=0 |
virtual EFeatureClass | get_feature_class ()=0 |
virtual int32_t | add_preproc (CPreProc *p) |
set preprocessor | |
virtual CPreProc * | del_preproc (int32_t num) |
del current preprocessor | |
CPreProc * | get_preproc (int32_t num) |
get current preprocessor | |
void | set_preprocessed (int32_t num) |
bool | is_preprocessed (int32_t num) |
int32_t | get_num_preprocessed () |
get whether specified preprocessor (or all if num=1) was/were already applied | |
int32_t | get_num_preproc () |
void | clean_preprocs () |
int32_t | get_cache_size () |
virtual int32_t | get_num_vectors ()=0 |
virtual bool | reshape (int32_t num_features, int32_t num_vectors) |
virtual int32_t | get_size ()=0 |
void | list_feature_obj () |
virtual void | load (CFile *loader) |
virtual void | save (CFile *writer) |
bool | check_feature_compatibility (CFeatures *f) |
bool | has_property (EFeatureProperty p) |
void | set_property (EFeatureProperty p) |
void | unset_property (EFeatureProperty p) |
CFeatures | ( | int32_t | size = 0 |
) |
copy constructor
Definition at line 28 of file Features.cpp.
constructor
loader | File object via which data shall be loaded |
Definition at line 40 of file Features.cpp.
~CFeatures | ( | ) | [virtual] |
Definition at line 49 of file Features.cpp.
int32_t add_preproc | ( | CPreProc * | p | ) | [virtual] |
set preprocessor
add preprocessor
p | preprocessor to set |
Definition at line 77 of file Features.cpp.
bool check_feature_compatibility | ( | CFeatures * | f | ) |
check feature compatibility
f | features to check for compatibility |
Definition at line 269 of file Features.cpp.
void clean_preprocs | ( | ) |
clears all preprocs
Definition at line 133 of file Features.cpp.
CPreProc * del_preproc | ( | int32_t | num | ) | [virtual] |
del current preprocessor
delete preprocessor from list caller has to clean up returned preproc
num | index of preprocessor in list |
Definition at line 139 of file Features.cpp.
virtual CFeatures* duplicate | ( | ) | const [pure virtual] |
duplicate feature object
abstract base method
Implemented in CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLBPPyrDotFeatures, CPolyFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CWDFeatures, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
int32_t get_cache_size | ( | ) |
virtual EFeatureClass get_feature_class | ( | ) | [pure virtual] |
get feature class
abstract base method
Implemented in CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLBPPyrDotFeatures, CPolyFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CWDFeatures, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
virtual EFeatureType get_feature_type | ( | ) | [pure virtual] |
get feature type
abstract base method
Implemented in CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLBPPyrDotFeatures, CPolyFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CWDFeatures, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
int32_t get_num_preproc | ( | ) |
get number of preprocessors
Definition at line 141 of file Features.h.
int32_t get_num_preprocessed | ( | ) |
get whether specified preprocessor (or all if num=1) was/were already applied
get the number of applied preprocs
Definition at line 119 of file Features.cpp.
virtual int32_t get_num_vectors | ( | ) | [pure virtual] |
get number of examples/vectors
abstract base method
Implemented in CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLBPPyrDotFeatures, CPolyFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CWDFeatures, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
CPreProc * get_preproc | ( | int32_t | num | ) |
get current preprocessor
get specified preprocessor
num | index of preprocessor in list |
Definition at line 107 of file Features.cpp.
virtual int32_t get_size | ( | ) | [pure virtual] |
get memory footprint of one feature
abstract base method
Implemented in CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLBPPyrDotFeatures, CPolyFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CWDFeatures, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
bool has_property | ( | EFeatureProperty | p | ) |
check if features have given property
p | feature property |
Definition at line 215 of file Features.h.
bool is_preprocessed | ( | int32_t | num | ) |
get whether specified preprocessor was already applied
num | index of preprocessor in list |
Definition at line 129 of file Features.h.
void list_feature_obj | ( | ) |
list feature object
Definition at line 184 of file Features.cpp.
virtual void load | ( | CFile * | loader | ) | [virtual] |
load features from file
loader | File object via which data shall be loaded |
Reimplemented in CSimpleFeatures< ST >, CSparseFeatures< ST >, CStringFeatures< ST >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
Definition at line 185 of file Features.h.
virtual bool reshape | ( | int32_t | num_features, | |
int32_t | num_vectors | |||
) | [virtual] |
in case there is a feature matrix allow for reshaping
NOT IMPLEMENTED!
num_features | new number of features | |
num_vectors | new number of vectors |
Reimplemented in CSimpleFeatures< ST >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, and CSimpleFeatures< uint16_t >.
Definition at line 168 of file Features.h.
virtual void save | ( | CFile * | writer | ) | [virtual] |
save features to file
writer | File object via which data shall be saved |
Reimplemented in CSimpleFeatures< ST >, CSparseFeatures< ST >, CStringFeatures< ST >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.
Definition at line 196 of file Features.h.
void set_preprocessed | ( | int32_t | num | ) |
set applied flag for preprocessor
num | index of preprocessor in list |
Definition at line 123 of file Features.h.
void set_property | ( | EFeatureProperty | p | ) |
void unset_property | ( | EFeatureProperty | p | ) |