SHOGUN v0.9.0
组合类型 | 公有成员 | 保护成员 | 保护属性
CSimpleFeatures< ST >模板类参考

详细描述

template<class ST>
class shogun::CSimpleFeatures< ST >

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.h64行定义。

继承图,类CSimpleFeatures< ST >
Inheritance graph
[图例]

所有成员的列表。

组合类型

struct  simple_feature_iterator

公有成员

 CSimpleFeatures (int32_t size=0)
 CSimpleFeatures (const CSimpleFeatures &orig)
 CSimpleFeatures (ST *src, int32_t num_feat, int32_t num_vec)
 CSimpleFeatures (CFile *loader)
virtual CFeaturesduplicate () 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)
CSimpleFeatures< ST > * get_transposed ()
ST * get_transposed (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)
void obtain_from_dot (CDotFeatures *df)
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)
void initialize_cache ()
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, CDotFeatures *df, 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 void load (CFile *loader)
virtual void save (CFile *saver)
virtual void * get_feature_iterator (int32_t vector_index)
virtual bool get_next_feature (int32_t &index, float64_t &value, void *iterator)
virtual void free_feature_iterator (void *iterator)
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
int32_t feature_matrix_num_vectors
int32_t feature_matrix_num_features
CCache< ST > * feature_cache

构造及析构函数文档

CSimpleFeatures ( int32_t  size = 0)

constructor

参数:
sizecache size

在文件SimpleFeatures.h71行定义。

CSimpleFeatures ( const CSimpleFeatures< ST > &  orig)

copy constructor

在文件SimpleFeatures.h78行定义。

CSimpleFeatures ( ST *  src,
int32_t  num_feat,
int32_t  num_vec 
)

constructor

参数:
srcfeature matrix
num_featnumber of features in matrix
num_vecnumber of vectors in matrix

在文件SimpleFeatures.h92行定义。

CSimpleFeatures ( CFile loader)

constructor loading features from file

参数:
loaderFile object via which to load data

在文件SimpleFeatures.h103行定义。

virtual ~CSimpleFeatures ( ) [virtual]

在文件SimpleFeatures.h119行定义。


成员函数文档

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

参数:
alphascalar alpha
vec_idx1index of first vector
vec2pointer to real valued vector
vec2_lenlength of real valued vector
abs_valif true add the absolute value

实现了CDotFeatures

在文件SimpleFeatures.h611行定义。

virtual bool Align_char_features ( CStringFeatures< char > *  cf,
CStringFeatures< char > *  Ref,
float64_t  gapCost 
) [virtual]

align char features

参数:
cfchar features
Refother char features
gapCostgap cost
返回:
if aligning was successful

在文件SimpleFeatures.h652行定义。

virtual bool apply_preproc ( bool  force_preprocessing = false) [virtual]

apply preprocessor

参数:
force_preprocessingif preprocssing shall be forced
返回:
if applying was successful

在文件SimpleFeatures.h439行定义。

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!

参数:
numnum
lenlen
target
返回:
feature vector

CFKFeaturesCRealFileFeaturesCTOPFeatures重载。

在文件SimpleFeatures.h762行定义。

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

参数:
srcfeature matrix to copy
num_featnumber of features in matrix
num_vecnumber of vectors in matrix

在文件SimpleFeatures.h388行定义。

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_idx1index of first vector
vec2pointer to real valued vector
vec2_lenlength of real valued vector

实现了CDotFeatures

virtual float64_t dot ( int32_t  vec_idx1,
CDotFeatures df,
int32_t  vec_idx2 
) [virtual]

compute dot product between vector1 and vector2, appointed by their indices

参数:
vec_idx1index of first vector
dfDotFeatures (of same kind) to compute dot product with
vec_idx2index of second vector

实现了CDotFeatures

在文件SimpleFeatures.h574行定义。

virtual CFeatures* duplicate ( ) const [virtual]

duplicate feature object

返回:
feature object

实现了CFeatures

在文件SimpleFeatures.h114行定义。

virtual void free_feature_iterator ( void *  iterator) [virtual]

clean up iterator call this function with the iterator returned by get_first_feature

参数:
iteratoras returned by get_first_feature

实现了CDotFeatures

在文件SimpleFeatures.h737行定义。

void free_feature_matrix ( )

free feature matrix

在文件SimpleFeatures.h127行定义。

void free_feature_vector ( ST *  feat_vec,
int32_t  num,
bool  dofree 
)

free feature vector

参数:
feat_vecfeature vector to free
numindex in feature cache
dofreeif vector should be really deleted

在文件SimpleFeatures.h270行定义。

void free_features ( )

free feature matrix and cache

在文件SimpleFeatures.h140行定义。

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())

返回:
dimensionality

实现了CDotFeatures

在文件SimpleFeatures.h562行定义。

virtual EFeatureClass get_feature_class ( ) [virtual]

get feature class

返回:
feature class SIMPLE

实现了CFeatures

在文件SimpleFeatures.h529行定义。

virtual void* get_feature_iterator ( int32_t  vector_index) [virtual]

iterate over the non-zero features

call get_feature_iterator first, followed by get_next_feature and free_feature_iterator to cleanup

参数:
vector_indexthe index of the vector over whose components to iterate over
返回:
feature iterator (to be passed to get_next_feature)

实现了CDotFeatures

在文件SimpleFeatures.h695行定义。

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

参数:
dstdestination to store matrix in
num_featnumber of features (rows of matrix)
num_vecnumber of vectors (columns of matrix)

在文件SimpleFeatures.h286行定义。

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_featnumber of features in matrix
num_vecnumber of vectors in matrix
返回:
feature matrix

在文件SimpleFeatures.h306行定义。

virtual EFeatureType get_feature_type ( ) [virtual]

get feature type

返回:
templated feature type

实现了CFeatures

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

参数:
numindex of feature vector
lenlength is returned by reference
dofreewhether returned vector must be freed by caller via free_feature_vector
返回:
feature vector

在文件SimpleFeatures.h156行定义。

void get_feature_vector ( ST **  dst,
int32_t *  len,
int32_t  num 
)

get feature vector num

参数:
dstdestination to store vector in
lenlength of vector
numindex of vector

在文件SimpleFeatures.h244行定义。

virtual const char* get_name ( void  ) const [virtual]
返回:
object name

实现了CSGObject

CFKFeaturesCRealFileFeaturesCTOPFeatures重载。

在文件SimpleFeatures.h748行定义。

virtual bool get_next_feature ( int32_t &  index,
float64_t value,
void *  iterator 
) [virtual]

iterate over the non-zero features

call this function with the iterator returned by get_first_feature and call free_feature_iterator to cleanup

参数:
indexis returned by reference (-1 when not available)
valueis returned by reference
iteratoras returned by get_first_feature
返回:
true if a new non-zero feature got returned

实现了CDotFeatures

在文件SimpleFeatures.h720行定义。

virtual int32_t get_nnz_features_for_vector ( int32_t  num) [virtual]

get number of non-zero features in vector

参数:
numwhich vector
返回:
number of non-zero features in vector

实现了CDotFeatures

在文件SimpleFeatures.h640行定义。

int32_t get_num_features ( )

get number of features

返回:
number of features

在文件SimpleFeatures.h492行定义。

virtual int32_t get_num_vectors ( ) [virtual]

get number of feature vectors

返回:
number of feature vectors

实现了CFeatures

在文件SimpleFeatures.h486行定义。

virtual int32_t get_size ( ) [virtual]

get memory footprint of one feature

返回:
memory footprint of one feature

实现了CFeatures

在文件SimpleFeatures.h479行定义。

CSimpleFeatures<ST>* get_transposed ( )

get a transposed copy of the features

返回:
transposed copy

在文件SimpleFeatures.h317行定义。

ST* get_transposed ( int32_t &  num_feat,
int32_t &  num_vec 
)

compute and return the transpose of the feature matrix which will be prepocessed. num_feat, num_vectors are returned by reference caller has to clean up

参数:
num_featnumber of features in matrix
num_vecnumber of vectors in matrix
返回:
transposed sparse feature matrix

在文件SimpleFeatures.h335行定义。

void initialize_cache ( )

在文件SimpleFeatures.h515行定义。

virtual void load ( CFile loader) [virtual]

load features from file

参数:
loaderFile object via which to load data

重载CFeatures

void obtain_from_dot ( CDotFeatures df)

obtain simple features from other dotfeatures

参数:
dfdotfeatures to obtain features from

在文件SimpleFeatures.h406行定义。

virtual bool reshape ( int32_t  p_num_features,
int32_t  p_num_vectors 
) [virtual]

reshape

参数:
p_num_featuresnew number of features
p_num_vectorsnew number of vectors
返回:
if reshaping was successful

重载CFeatures

在文件SimpleFeatures.h543行定义。

virtual void save ( CFile saver) [virtual]

save features to file

参数:
saverFile object via which to save data

重载CFeatures

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

参数:
fmfeature matrix to se
num_featnumber of features in matrix
num_vecnumber of vectors in matrix

在文件SimpleFeatures.h367行定义。

void set_feature_vector ( ST *  src,
int32_t  len,
int32_t  num 
)

set feature vector num

( only available in-memory feature matrices )

参数:
srcvector
lenlength of vector
numindex where to put vector to

在文件SimpleFeatures.h221行定义。

void set_num_features ( int32_t  num)

set number of features

参数:
numnumber to set

在文件SimpleFeatures.h498行定义。

void set_num_vectors ( int32_t  num)

set number of vectors

参数:
numnumber to set

在文件SimpleFeatures.h508行定义。


成员数据文档

CCache<ST>* feature_cache [protected]

feature cache

在文件SimpleFeatures.h806行定义。

ST* feature_matrix [protected]

Feature matrix and its associated number of vectors and features. Note that num_vectors / num_features above have the same sizes if feature_matrix != NULL

在文件SimpleFeatures.h801行定义。

int32_t feature_matrix_num_features [protected]

在文件SimpleFeatures.h803行定义。

int32_t feature_matrix_num_vectors [protected]

在文件SimpleFeatures.h802行定义。

int32_t num_features [protected]

number of features in cache

在文件SimpleFeatures.h795行定义。

int32_t num_vectors [protected]

number of vectors in cache

在文件SimpleFeatures.h792行定义。


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation