Public Member Functions | Protected Attributes

CFeatures Class Reference


Detailed Description

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.

Subsets may be supported by inheriting classes. Sub-classes may want to overwrite the subset_changed_post() method which is called automatically after each subset change

Definition at line 59 of file Features.h.

Inheritance diagram for CFeatures:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CFeatures (int32_t size=0)
 CFeatures (const CFeatures &orig)
 CFeatures (CFile *loader)
virtual CFeaturesduplicate () const =0
virtual ~CFeatures ()
virtual EFeatureType get_feature_type ()=0
virtual EFeatureClass get_feature_class ()=0
virtual int32_t add_preprocessor (CPreprocessor *p)
 set preprocessor
virtual CPreprocessordel_preprocessor (int32_t num)
 del current preprocessor
CPreprocessorget_preprocessor (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_preprocessors () const
void clean_preprocessors ()
int32_t get_cache_size ()
virtual int32_t get_num_vectors () const =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)
virtual void set_subset (CSubset *subset)
virtual void remove_subset ()
virtual void subset_changed_post ()
index_t subset_idx_conversion (index_t idx) const
bool has_subset () const
virtual CFeaturescopy_subset (SGVector< index_t > indices)

Protected Attributes

CSubsetm_subset

Constructor & Destructor Documentation

CFeatures ( int32_t  size = 0  ) 

constructor

Parameters:
size cache size

Definition at line 22 of file Features.cpp.

CFeatures ( const CFeatures orig  ) 

copy constructor

Definition at line 29 of file Features.cpp.

CFeatures ( CFile loader  ) 

constructor

Parameters:
loader File object via which data shall be loaded

Definition at line 41 of file Features.cpp.

~CFeatures (  )  [virtual]

Definition at line 50 of file Features.cpp.


Member Function Documentation

int32_t add_preprocessor ( CPreprocessor p  )  [virtual]

set preprocessor

add preprocessor

Parameters:
p preprocessor to set
Returns:
something inty

Definition at line 82 of file Features.cpp.

bool check_feature_compatibility ( CFeatures f  ) 

check feature compatibility

Parameters:
f features to check for compatibility
Returns:
if features are compatible

Definition at line 286 of file Features.cpp.

void clean_preprocessors (  ) 

clears all preprocs

Definition at line 138 of file Features.cpp.

virtual CFeatures* copy_subset ( SGVector< index_t indices  )  [virtual]

Creates a new CFeatures instance containing copies of the elements which are specified by the provided indices.

This method is needed for a KernelMachine to store its model data. NOT IMPLEMENTED!

Parameters:
indices indices of feature elements to copy
Returns:
new CFeatures instance with copies of feature data

Reimplemented in CSimpleFeatures< ST >, CSparseFeatures< ST >, CStringFeatures< ST >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< T >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CSparseFeatures< T >, CStringFeatures< T >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.

Definition at line 283 of file Features.h.

CPreprocessor * del_preprocessor ( int32_t  num  )  [virtual]

del current preprocessor

delete preprocessor from list caller has to clean up returned preproc

Parameters:
num index of preprocessor in list

Definition at line 144 of file Features.cpp.

virtual CFeatures* duplicate (  )  const [pure virtual]
int32_t get_cache_size (  ) 

get cache size

Returns:
cache size

Definition at line 156 of file Features.h.

virtual EFeatureClass get_feature_class (  )  [pure virtual]
virtual EFeatureType get_feature_type (  )  [pure virtual]
int32_t get_num_preprocessed (  ) 

get whether specified preprocessor (or all if num=1) was/were already applied

get the number of applied preprocs

Returns:
number of applied preprocessors

Definition at line 124 of file Features.cpp.

int32_t get_num_preprocessors (  )  const

get number of preprocessors

Returns:
number of preprocessors

Definition at line 147 of file Features.h.

virtual int32_t get_num_vectors (  )  const [pure virtual]
CPreprocessor * get_preprocessor ( int32_t  num  ) 

get current preprocessor

get specified preprocessor

Parameters:
num index of preprocessor in list

Definition at line 112 of file Features.cpp.

virtual int32_t get_size (  )  [pure virtual]
bool has_property ( EFeatureProperty  p  ) 

check if features have given property

Parameters:
p feature property
Returns:
if features have given property

Definition at line 225 of file Features.h.

bool has_subset (  )  const

check if has subsets

Returns:
true if has subsets

Definition at line 272 of file Features.h.

bool is_preprocessed ( int32_t  num  ) 

get whether specified preprocessor was already applied

Parameters:
num index of preprocessor in list

Definition at line 135 of file Features.h.

void list_feature_obj (  ) 

list feature object

Definition at line 189 of file Features.cpp.

virtual void load ( CFile loader  )  [virtual]
void remove_subset (  )  [virtual]

deletes any set subset subset_changed_post() is called afterwards

Definition at line 304 of file Features.cpp.

virtual bool reshape ( int32_t  num_features,
int32_t  num_vectors 
) [virtual]

in case there is a feature matrix allow for reshaping

NOT IMPLEMENTED!

Parameters:
num_features new number of features
num_vectors new number of vectors
Returns:
if reshaping was successful

Reimplemented in CSimpleFeatures< ST >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< T >, and CSimpleFeatures< uint16_t >.

Definition at line 174 of file Features.h.

virtual void save ( CFile writer  )  [virtual]
void set_preprocessed ( int32_t  num  ) 

set applied flag for preprocessor

Parameters:
num index of preprocessor in list

Definition at line 129 of file Features.h.

void set_property ( EFeatureProperty  p  ) 

set property

Parameters:
p kernel property to set

Definition at line 231 of file Features.h.

void set_subset ( CSubset subset  )  [virtual]

setter for subset variable, deletes old one subset_changed_post() is called afterwards

Parameters:
subset subset instance to set

Definition at line 296 of file Features.cpp.

virtual void subset_changed_post (  )  [virtual]

method may be overwritten to update things that depend on subset

Reimplemented in CStringFeatures< ST >, CStringFeatures< T >, CStringFeatures< uint8_t >, CStringFeatures< char >, and CStringFeatures< uint16_t >.

Definition at line 257 of file Features.h.

index_t subset_idx_conversion ( index_t  idx  )  const

does subset index conversion with the underlying subset if possible

Parameters:
idx index to convert
Returns:
converted index

Definition at line 264 of file Features.h.

void unset_property ( EFeatureProperty  p  ) 

unset property

Parameters:
p kernel property to unset

Definition at line 240 of file Features.h.


Member Data Documentation

CSubset* m_subset [protected]

subset class to enable subset support for this class

Definition at line 310 of file Features.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation