Public Member Functions | |
CSimpleFeatures (int32_t size=0) | |
CSimpleFeatures (const CSimpleFeatures &orig) | |
CSimpleFeatures (ST *fm, int32_t num_feat, int32_t num_vec) | |
CSimpleFeatures (char *fname) | |
virtual CFeatures * | duplicate () const |
virtual | ~CSimpleFeatures () |
void | free_feature_matrix () |
void | free_features () |
ST * | get_feature_vector (int32_t num, int32_t &len, bool &dofree) |
void | free_feature_vector (ST *feat_vec, int32_t num, bool dofree) |
void | get_fm (ST **dst, int32_t *d1, int32_t *d2) |
ST * | get_feature_matrix (int32_t &num_feat, int32_t &num_vec) |
virtual void | set_feature_matrix (ST *fm, int32_t num_feat, int32_t num_vec) |
virtual void | copy_feature_matrix (ST *src, int32_t num_feat, int32_t num_vec) |
virtual bool | apply_preproc (bool force_preprocessing=false) |
virtual int32_t | get_size () |
virtual int32_t | get_num_vectors () |
int32_t | get_num_features () |
void | set_num_features (int32_t num) |
void | set_num_vectors (int32_t num) |
virtual EFeatureClass | get_feature_class () |
virtual EFeatureType | get_feature_type () |
virtual bool | reshape (int32_t p_num_features, int32_t p_num_vectors) |
template<> | |
EFeatureType | get_feature_type () |
Protected Member Functions | |
virtual ST * | compute_feature_vector (int32_t num, int32_t &len, ST *target=NULL) |
Protected Attributes | |
int32_t | num_vectors |
number of vectors in cache | |
int32_t | num_features |
number of features in cache | |
ST * | feature_matrix |
CCache< ST > * | feature_cache |
There are get_num_vectors() many feature vectors, of dimension get_num_features(). To access a feature vector call get_feature_vector() and when you are done treating it call free_feature_vector(). While free_feature_vector() is a NOP in most cases feature vectors might have been generated on the fly (due to a number preprocessors being attached to them).
From this template class a number of dense feature matrix classes are derived. They all are only shortcuts for different data types and heavily rely on this class:
8bit char matrix - CCharFeatures 8bit Byte matrix - CByteFeatures 16bit Integer matrix - CShortFeatures 16bit Word matrix - CWordFeatures 32bit Float matrix - CShortRealFeatures 64bit Double matrix - CRealFeatures 64bit Double matrix in a file - CRealFileFeatures 64bit Tangent of posterior log-odds (TOP) features from HMM - CTOPFeatures 64bit Fisher Kernel (FK) features from HMM - CTOPFeatures 32bit Integer matrix - CIntFeatures
Definition at line 55 of file SimpleFeatures.h.
CSimpleFeatures< ST >::CSimpleFeatures | ( | int32_t | size = 0 |
) |
CSimpleFeatures< ST >::CSimpleFeatures | ( | const CSimpleFeatures< ST > & | orig | ) |
copy constructor
Definition at line 67 of file SimpleFeatures.h.
CSimpleFeatures< ST >::CSimpleFeatures | ( | ST * | fm, | |
int32_t | num_feat, | |||
int32_t | num_vec | |||
) |
constructor
fm | feature matrix | |
num_feat | number of features in matrix | |
num_vec | number of vectors in matrix |
Definition at line 87 of file SimpleFeatures.h.
CSimpleFeatures< ST >::CSimpleFeatures | ( | char * | fname | ) |
constructor
NOT IMPLEMENTED!
fname | filename to load features from |
Definition at line 100 of file SimpleFeatures.h.
virtual CSimpleFeatures< ST >::~CSimpleFeatures | ( | ) | [virtual] |
Definition at line 113 of file SimpleFeatures.h.
virtual bool CSimpleFeatures< ST >::apply_preproc | ( | bool | force_preprocessing = false |
) | [virtual] |
apply preprocessor
force_preprocessing | if preprocssing shall be forced |
Definition at line 297 of file SimpleFeatures.h.
virtual ST* CSimpleFeatures< ST >::compute_feature_vector | ( | int32_t | num, | |
int32_t & | len, | |||
ST * | target = NULL | |||
) | [protected, virtual] |
compute feature vector for sample num if target is set the vector is written to target len is returned by reference
NOT IMPLEMENTED!
num | num | |
len | len | |
target |
Reimplemented in CFKFeatures, CRealFileFeatures, and CTOPFeatures.
Definition at line 419 of file SimpleFeatures.h.
virtual void CSimpleFeatures< ST >::copy_feature_matrix | ( | ST * | src, | |
int32_t | num_feat, | |||
int32_t | num_vec | |||
) | [virtual] |
copy feature matrix store copy of feature_matrix, where num_features is the column offset, and columns are linear in memory see below for definition of feature_matrix
src | feature matrix to copy | |
num_feat | number of features in matrix | |
num_vec | number of vectors in matrix |
Reimplemented in CByteFeatures, CCharFeatures, CIntFeatures, CRealFeatures, CShortFeatures, CShortRealFeatures, and CWordFeatures.
Definition at line 282 of file SimpleFeatures.h.
virtual CFeatures* CSimpleFeatures< ST >::duplicate | ( | ) | const [virtual] |
duplicate feature object
Implements CFeatures.
Definition at line 108 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::free_feature_matrix | ( | ) |
free feature matrix
Definition at line 122 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::free_feature_vector | ( | ST * | feat_vec, | |
int32_t | num, | |||
bool | dofree | |||
) |
free feature vector
feat_vec | feature vector to free | |
num | index in feature cache | |
dofree | if vector should be really deleted |
Definition at line 214 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::free_features | ( | ) |
free feature matrix and cache
Definition at line 133 of file SimpleFeatures.h.
virtual EFeatureClass CSimpleFeatures< ST >::get_feature_class | ( | ) | [virtual] |
get feature class
Implements CFeatures.
Definition at line 381 of file SimpleFeatures.h.
ST* CSimpleFeatures< ST >::get_feature_matrix | ( | int32_t & | num_feat, | |
int32_t & | num_vec | |||
) |
get the pointer to the feature matrix num_feat,num_vectors are returned by reference
num_feat | number of features in matrix | |
num_vec | number of vectors in matrix |
Definition at line 248 of file SimpleFeatures.h.
EFeatureType CSimpleFeatures< uint64_t >::get_feature_type | ( | ) | [virtual] |
get feature type the ULONG feature can deal with
Implements CFeatures.
Definition at line 505 of file SimpleFeatures.h.
virtual EFeatureType CSimpleFeatures< ST >::get_feature_type | ( | ) | [virtual] |
get feature type
Implements CFeatures.
Reimplemented in CByteFeatures, and CShortFeatures.
ST* CSimpleFeatures< ST >::get_feature_vector | ( | int32_t | num, | |
int32_t & | len, | |||
bool & | dofree | |||
) |
get feature vector for sample num from the matrix as it is if matrix is initialized, else return preprocessed compute_feature_vector
num | index of feature vector | |
len | length is returned by reference | |
dofree | whether returned vector must be freed by caller via free_feature_vector |
Definition at line 150 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::get_fm | ( | ST ** | dst, | |
int32_t * | d1, | |||
int32_t * | d2 | |||
) |
get the pointer to the feature matrix num_feat,num_vectors are returned by reference
dst | destination to store matrix in | |
d1 | dimension 1 of matrix | |
d2 | dimension 2 of matrix |
Reimplemented in CIntFeatures, CRealFeatures, CShortRealFeatures, and CWordFeatures.
Definition at line 230 of file SimpleFeatures.h.
int32_t CSimpleFeatures< ST >::get_num_features | ( | ) |
virtual int32_t CSimpleFeatures< ST >::get_num_vectors | ( | ) | [virtual] |
get number of feature vectors
Implements CFeatures.
Definition at line 340 of file SimpleFeatures.h.
virtual int32_t CSimpleFeatures< ST >::get_size | ( | ) | [virtual] |
get memory footprint of one feature
Implements CFeatures.
Definition at line 333 of file SimpleFeatures.h.
virtual bool CSimpleFeatures< ST >::reshape | ( | int32_t | p_num_features, | |
int32_t | p_num_vectors | |||
) | [virtual] |
reshape
p_num_features | new number of features | |
p_num_vectors | new number of vectors |
Reimplemented from CFeatures.
Definition at line 395 of file SimpleFeatures.h.
virtual void CSimpleFeatures< ST >::set_feature_matrix | ( | ST * | fm, | |
int32_t | num_feat, | |||
int32_t | num_vec | |||
) | [virtual] |
set feature matrix necessary to set feature_matrix, num_features, num_vectors, where num_features is the column offset, and columns are linear in memory see below for definition of feature_matrix
fm | feature matrix to se | |
num_feat | number of features in matrix | |
num_vec | number of vectors in matrix |
Definition at line 265 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::set_num_features | ( | int32_t | num | ) |
set number of features
num | number to set |
Definition at line 352 of file SimpleFeatures.h.
void CSimpleFeatures< ST >::set_num_vectors | ( | int32_t | num | ) |
set number of vectors
num | number to set |
Definition at line 367 of file SimpleFeatures.h.
CCache<ST>* CSimpleFeatures< ST >::feature_cache [protected] |
feature cache
Definition at line 435 of file SimpleFeatures.h.
ST* CSimpleFeatures< ST >::feature_matrix [protected] |
feature matrix
Definition at line 432 of file SimpleFeatures.h.
int32_t CSimpleFeatures< ST >::num_features [protected] |
int32_t CSimpleFeatures< ST >::num_vectors [protected] |