The class SimpleFeatures implements dense feature matrices.
The feature matrices are stored en-block in memory in fortran order, i.e. column-by-column, where a column denotes a feature vector.
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 the following dense feature matrix types are used and supported:
在文件SimpleFeatures.h第61行定义。

公有成员 | |
| CSimpleFeatures (int32_t size=0) | |
| CSimpleFeatures (const CSimpleFeatures &orig) | |
| CSimpleFeatures (ST *src, 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 | set_feature_vector (ST *src, int32_t len, int32_t num) |
| void | get_feature_vector (ST **dst, int32_t *len, int32_t num) |
| void | free_feature_vector (ST *feat_vec, int32_t num, bool dofree) |
| void | get_feature_matrix (ST **dst, int32_t *num_feat, int32_t *num_vec) |
| 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) |
| virtual int32_t | get_dim_feature_space () |
| virtual float64_t | dot (int32_t vec_idx1, int32_t vec_idx2) |
| virtual float64_t | dense_dot (int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len) |
| virtual void | add_to_dense_vec (float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false) |
| virtual int32_t | get_nnz_features_for_vector (int32_t num) |
| virtual bool | Align_char_features (CStringFeatures< char > *cf, CStringFeatures< char > *Ref, float64_t gapCost) |
| virtual bool | load (char *fname) |
| virtual bool | save (char *fname) |
| virtual const char * | get_name () const |
保护成员 | |
| virtual ST * | compute_feature_vector (int32_t num, int32_t &len, ST *target=NULL) |
保护属性 | |
| 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 |
| CSimpleFeatures | ( | int32_t | size = 0 |
) |
| CSimpleFeatures | ( | const CSimpleFeatures< ST > & | orig | ) |
copy constructor
在文件SimpleFeatures.h第73行定义。
| CSimpleFeatures | ( | ST * | src, | |
| int32_t | num_feat, | |||
| int32_t | num_vec | |||
| ) |
constructor
| src | feature matrix | |
| num_feat | number of features in matrix | |
| num_vec | number of vectors in matrix |
在文件SimpleFeatures.h第93行定义。
| CSimpleFeatures | ( | char * | fname | ) |
| virtual ~CSimpleFeatures | ( | ) | [virtual] |
在文件SimpleFeatures.h第119行定义。
| virtual void add_to_dense_vec | ( | float64_t | alpha, | |
| int32_t | vec_idx1, | |||
| float64_t * | vec2, | |||
| int32_t | vec2_len, | |||
| bool | abs_val = false | |||
| ) | [virtual] |
add vector 1 multiplied with alpha to dense vector2
| alpha | scalar alpha | |
| vec_idx1 | index of first vector | |
| vec2 | pointer to real valued vector | |
| vec2_len | length of real valued vector | |
| abs_val | if true add the absolute value |
实现了CDotFeatures。
在文件SimpleFeatures.h第520行定义。
| virtual bool Align_char_features | ( | CStringFeatures< char > * | cf, | |
| CStringFeatures< char > * | Ref, | |||
| float64_t | gapCost | |||
| ) | [virtual] |
align char features
| cf | char features | |
| Ref | other char features | |
| gapCost | gap cost |
在文件SimpleFeatures.h第561行定义。
| virtual bool apply_preproc | ( | bool | force_preprocessing = false |
) | [virtual] |
apply preprocessor
| force_preprocessing | if preprocssing shall be forced |
在文件SimpleFeatures.h第356行定义。
| virtual 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 |
被CFKFeatures、CRealFileFeatures及CTOPFeatures重载。
在文件SimpleFeatures.h第698行定义。
| virtual void 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 |
在文件SimpleFeatures.h第341行定义。
| virtual float64_t dense_dot | ( | int32_t | vec_idx1, | |
| const float64_t * | vec2, | |||
| int32_t | vec2_len | |||
| ) | [virtual] |
compute dot product between vector1 and a dense vector
| vec_idx1 | index of first vector | |
| vec2 | pointer to real valued vector | |
| vec2_len | length of real valued vector |
实现了CDotFeatures。
| virtual float64_t dot | ( | int32_t | vec_idx1, | |
| int32_t | vec_idx2 | |||
| ) | [virtual] |
compute dot product between vector1 and vector2, appointed by their indices
| vec_idx1 | index of first vector | |
| vec_idx2 | index of second vector |
实现了CDotFeatures。
在文件SimpleFeatures.h第488行定义。
| virtual CFeatures* duplicate | ( | ) | const [virtual] |
| void free_feature_matrix | ( | ) |
free feature matrix
在文件SimpleFeatures.h第128行定义。
| void 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 |
在文件SimpleFeatures.h第273行定义。
| void free_features | ( | ) |
free feature matrix and cache
在文件SimpleFeatures.h第139行定义。
| virtual int32_t get_dim_feature_space | ( | ) | [virtual] |
obtain the dimensionality of the feature space
(not mix this up with the dimensionality of the input space, usually obtained via get_num_features())
实现了CDotFeatures。
在文件SimpleFeatures.h第477行定义。
| virtual EFeatureClass get_feature_class | ( | ) | [virtual] |
| 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 |
在文件SimpleFeatures.h第307行定义。
| void get_feature_matrix | ( | ST ** | dst, | |
| int32_t * | num_feat, | |||
| int32_t * | num_vec | |||
| ) |
get a copy of the feature matrix num_feat,num_vectors are returned by reference
| dst | destination to store matrix in | |
| num_feat | number of features (rows of matrix) | |
| num_vec | number of vectors (columns of matrix) |
在文件SimpleFeatures.h第289行定义。
| virtual EFeatureType get_feature_type | ( | ) | [virtual] |
| void get_feature_vector | ( | ST ** | dst, | |
| int32_t * | len, | |||
| int32_t | num | |||
| ) |
get feature vector num
| dst | destination to store vector in | |
| len | length of vector | |
| num | index of vector |
在文件SimpleFeatures.h第247行定义。
| 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 |
在文件SimpleFeatures.h第156行定义。
| virtual const char* get_name | ( | ) | const [virtual] |
实现了CSGObject。
被CFKFeatures、CRealFileFeatures及CTOPFeatures重载。
在文件SimpleFeatures.h第623行定义。
| virtual int32_t get_nnz_features_for_vector | ( | int32_t | num | ) | [virtual] |
get number of non-zero features in vector
| num | which vector |
实现了CDotFeatures。
在文件SimpleFeatures.h第549行定义。
| int32_t get_num_features | ( | ) |
| virtual int32_t get_num_vectors | ( | ) | [virtual] |
get number of feature vectors
实现了CFeatures。
在文件SimpleFeatures.h第403行定义。
| virtual int32_t get_size | ( | ) | [virtual] |
get memory footprint of one feature
实现了CFeatures。
在文件SimpleFeatures.h第396行定义。
| virtual bool load | ( | char * | fname | ) | [virtual] |
load features from file
| fname | filename to load from |
重载CFeatures。
在文件SimpleFeatures.h第572行定义。
| virtual bool 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 |
重载CFeatures。
在文件SimpleFeatures.h第458行定义。
| virtual bool save | ( | char * | fname | ) | [virtual] |
save features to file
| fname | filename to save to |
重载CFeatures。
在文件SimpleFeatures.h第596行定义。
| virtual void 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 |
在文件SimpleFeatures.h第324行定义。
| void set_feature_vector | ( | ST * | src, | |
| int32_t | len, | |||
| int32_t | num | |||
| ) |
set feature vector num
( only available in-memory feature matrices )
| src | vector | |
| len | length of vector | |
| num | index where to put vector to |
在文件SimpleFeatures.h第224行定义。
| void set_num_features | ( | int32_t | num | ) |
| void set_num_vectors | ( | int32_t | num | ) |
CCache<ST>* feature_cache [protected] |
feature cache
在文件SimpleFeatures.h第714行定义。
ST* feature_matrix [protected] |
feature matrix
在文件SimpleFeatures.h第711行定义。
int32_t num_features [protected] |
number of features in cache
在文件SimpleFeatures.h第708行定义。
int32_t num_vectors [protected] |
number of vectors in cache
在文件SimpleFeatures.h第705行定义。