SHOGUN  v3.2.0
所有成员列表 | Public 成员函数 | Public 属性 | Protected 成员函数 | Protected 属性
CStreamingVwFeatures类 参考

详细描述

This class implements streaming features for use with VW.

Each example is stored in a VwExample object, which also contains label and other information. Features are hashed and are supposed to be used with a weight vector of preallocated dimensions.

在文件 StreamingVwFeatures.h39 行定义.

类 CStreamingVwFeatures 继承关系图:
Inheritance graph
[图例]

Public 成员函数

 CStreamingVwFeatures ()
 
 CStreamingVwFeatures (CStreamingVwFile *file, bool is_labelled, int32_t size)
 
 CStreamingVwFeatures (CStreamingVwCacheFile *file, bool is_labelled, int32_t size)
 
 ~CStreamingVwFeatures ()
 
CFeaturesduplicate () const
 
virtual void set_vector_reader ()
 
virtual void set_vector_and_label_reader ()
 
virtual void start_parser ()
 
virtual void end_parser ()
 
virtual void reset_stream ()
 
virtual CVwEnvironmentget_env ()
 
virtual void set_env (CVwEnvironment *vw_env)
 
virtual bool get_next_example ()
 
virtual VwExampleget_example ()
 
virtual float64_t get_label ()
 
virtual void release_example ()
 
virtual void expand_if_required (float32_t *&vec, int32_t &len)
 
virtual void expand_if_required (float64_t *&vec, int32_t &len)
 
virtual int32_t get_dim_feature_space () const
 
virtual float32_t real_weight (float32_t w, float32_t gravity)
 
virtual float32_t dot (CStreamingDotFeatures *df)
 
virtual float32_t dense_dot (VwExample *&ex, const float32_t *vec2)
 
virtual float32_t dense_dot (const float32_t *vec2, int32_t vec2_len)
 
virtual float32_t dense_dot (SGSparseVector< float32_t > *vec1, const float32_t *vec2)
 
virtual float32_t dense_dot_truncated (const float32_t *vec2, VwExample *&ex, float32_t gravity)
 
virtual void add_to_dense_vec (float32_t alpha, VwExample *&ex, float32_t *vec2, int32_t vec2_len, bool abs_val=false)
 
virtual void add_to_dense_vec (float32_t alpha, float32_t *vec2, int32_t vec2_len, bool abs_val=false)
 
virtual int32_t get_nnz_features_for_vector ()
 
virtual int32_t get_num_features ()
 
virtual EFeatureType get_feature_type () const
 
virtual EFeatureClass get_feature_class () const
 
virtual const char * get_name () const
 
virtual int32_t get_num_vectors () const
 
virtual void dense_dot_range (float32_t *output, float32_t *alphas, float32_t *vec, int32_t dim, float32_t b, int32_t num_vec=0)
 
virtual void * get_feature_iterator ()
 
virtual bool get_next_feature (int32_t &index, float32_t &value, void *iterator)
 
virtual void free_feature_iterator (void *iterator)
 
void set_read_functions ()
 
virtual bool get_has_labels ()
 
virtual bool is_seekable ()
 
virtual CFeaturesget_streamed_features (index_t num_elements)
 
virtual void add_preprocessor (CPreprocessor *p)
 
virtual void del_preprocessor (int32_t num)
 
CPreprocessorget_preprocessor (int32_t num) const
 
void set_preprocessed (int32_t num)
 
bool is_preprocessed (int32_t num) const
 
int32_t get_num_preprocessed () const
 
int32_t get_num_preprocessors () const
 
void clean_preprocessors ()
 
void list_preprocessors ()
 
int32_t get_cache_size () const
 
virtual bool reshape (int32_t num_features, int32_t num_vectors)
 
void list_feature_obj () const
 
virtual void load (CFile *loader)
 
virtual void save (CFile *writer)
 
bool check_feature_compatibility (CFeatures *f) const
 
bool has_property (EFeatureProperty p) const
 
void set_property (EFeatureProperty p)
 
void unset_property (EFeatureProperty p)
 
virtual CFeaturescreate_merged_copy (CList *others)
 
virtual CFeaturescreate_merged_copy (CFeatures *other)
 
virtual void add_subset (SGVector< index_t > subset)
 
virtual void remove_subset ()
 
virtual void remove_all_subsets ()
 
virtual CSubsetStackget_subset_stack ()
 
virtual void subset_changed_post ()
 
virtual CFeaturescopy_subset (SGVector< index_t > indices)
 
virtual CSGObjectshallow_copy () const
 
virtual CSGObjectdeep_copy () const
 
virtual bool is_generic (EPrimitiveType *generic) const
 
template<class T >
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
void unset_generic ()
 
virtual void print_serializable (const char *prefix="")
 
virtual bool save_serializable (CSerializableFile *file, const char *prefix="", int32_t param_version=Version::get_version_parameter())
 
virtual bool load_serializable (CSerializableFile *file, const char *prefix="", int32_t param_version=Version::get_version_parameter())
 
DynArray< TParameter * > * load_file_parameters (const SGParamInfo *param_info, int32_t file_version, CSerializableFile *file, const char *prefix="")
 
DynArray< TParameter * > * load_all_file_parameters (int32_t file_version, int32_t current_version, CSerializableFile *file, const char *prefix="")
 
void map_parameters (DynArray< TParameter *> *param_base, int32_t &base_version, DynArray< const SGParamInfo *> *target_param_infos)
 
void set_global_io (SGIO *io)
 
SGIOget_global_io ()
 
void set_global_parallel (Parallel *parallel)
 
Parallelget_global_parallel ()
 
void set_global_version (Version *version)
 
Versionget_global_version ()
 
SGStringList< char > get_modelsel_names ()
 
void print_modsel_params ()
 
char * get_modsel_param_descr (const char *param_name)
 
index_t get_modsel_param_index (const char *param_name)
 
void build_gradient_parameter_dictionary (CMap< TParameter *, CSGObject *> *dict)
 
virtual bool update_parameter_hash ()
 
virtual bool equals (CSGObject *other, float64_t accuracy=0.0)
 
virtual CSGObjectclone ()
 

Public 属性

SGIOio
 
Parallelparallel
 
Versionversion
 
Parameterm_parameters
 
Parameterm_model_selection_parameters
 
Parameterm_gradient_parameters
 
ParameterMapm_parameter_map
 
uint32_t m_hash
 

Protected 成员函数

virtual TParametermigrate (DynArray< TParameter *> *param_base, const SGParamInfo *target)
 
virtual void one_to_one_migration_prepare (DynArray< TParameter *> *param_base, const SGParamInfo *target, TParameter *&replacement, TParameter *&to_migrate, char *old_name=NULL)
 
virtual void load_serializable_pre () throw (ShogunException)
 
virtual void load_serializable_post () throw (ShogunException)
 
virtual void save_serializable_pre () throw (ShogunException)
 
virtual void save_serializable_post () throw (ShogunException)
 

Protected 属性

CInputParser< VwExampleparser
 The parser object, which reads from input and returns parsed example objects. 更多...
 
vw_size_t example_count
 Number of examples processed at a point of time 更多...
 
float64_t current_label
 The current example's label. 更多...
 
int32_t current_length
 Number of features in current example. 更多...
 
CVwEnvironmentenv
 Environment for VW 更多...
 
VwExamplecurrent_example
 Example currently being processed 更多...
 
float32_t combined_weight
 feature weighting in combined dot features 更多...
 
bool has_labels
 Whether examples are labelled or not. 更多...
 
CStreamingFileworking_file
 The StreamingFile object to read from. 更多...
 
bool seekable
 Whether the stream is seekable 更多...
 
CSubsetStackm_subset_stack
 

构造及析构函数说明

◆ CStreamingVwFeatures() [1/3]

Default constructor.

Sets the reading functions to be CStreamingFile::get_*_vector and get_*_vector_and_label depending on the type T.

在文件 StreamingVwFeatures.cpp20 行定义.

◆ CStreamingVwFeatures() [2/3]

CStreamingVwFeatures ( CStreamingVwFile file,
bool  is_labelled,
int32_t  size 
)

Constructor taking args. Initializes the parser with the given args.

参数
fileStreamingFile object, input file.
is_labelledWhether examples are labelled or not.
sizeNumber of example objects to be stored in the parser at a time.

在文件 StreamingVwFeatures.cpp26 行定义.

◆ CStreamingVwFeatures() [3/3]

CStreamingVwFeatures ( CStreamingVwCacheFile file,
bool  is_labelled,
int32_t  size 
)

Constructor used when initialized with a cache file.

参数
fileStreamingVwCacheFile object
is_labelledWhether examples are labelled or not
sizeNumber of example objects to be stored in the parser at a time

在文件 StreamingVwFeatures.cpp34 行定义.

◆ ~CStreamingVwFeatures()

Destructor.

Ends the parsing thread. (Waits for pthread_join to complete)

在文件 StreamingVwFeatures.cpp42 行定义.

成员函数说明

◆ add_preprocessor()

void add_preprocessor ( CPreprocessor p)
virtualinherited

add preprocessor

参数
ppreprocessor to set

在文件 Features.cpp82 行定义.

◆ add_subset()

void add_subset ( SGVector< index_t subset)
virtualinherited

adds a subset of indices on top of the current subsets (possibly subset o subset. Calls subset_changed_post() afterwards

参数
subsetsubset of indices to add

CCombinedFeatures 重载.

在文件 Features.cpp307 行定义.

◆ add_to_dense_vec() [1/2]

void add_to_dense_vec ( float32_t  alpha,
VwExample *&  ex,
float32_t vec2,
int32_t  vec2_len,
bool  abs_val = false 
)
virtual

Add alpha*an example's feature vector to another dense vector. Takes the absolute value of current_vector if specified

参数
alphaalpha
exexample whose vector should be used
vec2vector to add to
vec2_lenlength of vector
abs_valtrue if abs of example's vector should be taken

在文件 StreamingVwFeatures.cpp347 行定义.

◆ add_to_dense_vec() [2/2]

void add_to_dense_vec ( float32_t  alpha,
float32_t vec2,
int32_t  vec2_len,
bool  abs_val = false 
)
virtual

Add alpha*current_vector to another dense vector. Takes the absolute value of current_vector if specified

参数
alphaalpha
vec2vector to add to
vec2_lenlength of vector
abs_valtrue if abs of current_vector should be taken

实现了 CStreamingDotFeatures.

在文件 StreamingVwFeatures.cpp367 行定义.

◆ build_gradient_parameter_dictionary()

void build_gradient_parameter_dictionary ( CMap< TParameter *, CSGObject *> *  dict)
inherited

Builds a dictionary of all parameters in SGObject as well of those of SGObjects that are parameters of this object. Dictionary maps parameters to the objects that own them.

参数
dictdictionary of parameters to be built.

在文件 SGObject.cpp1156 行定义.

◆ check_feature_compatibility()

bool check_feature_compatibility ( CFeatures f) const
inherited

check feature compatibility

参数
ffeatures to check for compatibility
返回
if features are compatible

在文件 Features.cpp280 行定义.

◆ clean_preprocessors()

void clean_preprocessors ( )
inherited

clears all preprocs

在文件 Features.cpp113 行定义.

◆ clone()

CSGObject * clone ( )
virtualinherited

Creates a clone of the current object. This is done via recursively traversing all parameters, which corresponds to a deep copy. Calling equals on the cloned object always returns true although none of the memory of both objects overlaps.

返回
an identical copy of the given object, which is disjoint in memory. NULL if the clone fails. Note that the returned object is SG_REF'ed

在文件 SGObject.cpp1273 行定义.

◆ copy_subset()

CFeatures * copy_subset ( SGVector< index_t indices)
virtualinherited

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!

参数
indicesindices of feature elements to copy
返回
new CFeatures instance with copies of feature data

CStringFeatures< ST >, CStringFeatures< T >, CStringFeatures< uint8_t >, CStringFeatures< char >, CStringFeatures< uint16_t >, CSparseFeatures< ST >, CSparseFeatures< float64_t >, CSparseFeatures< T >, CDenseFeatures< ST >, CDenseFeatures< uint32_t >, CDenseFeatures< float64_t >, CDenseFeatures< T >, CDenseFeatures< uint16_t > , 以及 CCombinedFeatures 重载.

在文件 Features.cpp330 行定义.

◆ create_merged_copy() [1/2]

virtual CFeatures* create_merged_copy ( CList others)
virtualinherited

Takes a list of feature instances and returns a new instance being a concatenation of a copy of this instace's data and the given instancess data. Note that the feature types have to be equal.

NOT IMPLEMENTED!

参数
otherslist of feature objects to append
返回
new feature object which contains copy of data of this instance and given ones

CDenseFeatures< ST >, CDenseFeatures< uint32_t >, CDenseFeatures< float64_t >, CDenseFeatures< T > , 以及 CDenseFeatures< uint16_t > 重载.

在文件 Features.h229 行定义.

◆ create_merged_copy() [2/2]

virtual CFeatures* create_merged_copy ( CFeatures other)
virtualinherited

Convenience method for method with same name and list as parameter.

NOT IMPLEMENTED!

参数
otherfeature object to append
返回
new feature object which contains copy of data of this instance and of given one

CDenseFeatures< ST >, CDenseFeatures< uint32_t >, CDenseFeatures< float64_t >, CDenseFeatures< T >, CDenseFeatures< uint16_t > , 以及 CCombinedFeatures 重载.

在文件 Features.h243 行定义.

◆ deep_copy()

virtual CSGObject* deep_copy ( ) const
virtualinherited

A deep copy. All the instance variables will also be copied.

在文件 SGObject.h126 行定义.

◆ del_preprocessor()

void del_preprocessor ( int32_t  num)
virtualinherited

delete preprocessor from list

参数
numindex of preprocessor in list

在文件 Features.cpp119 行定义.

◆ dense_dot() [1/3]

float32_t dense_dot ( VwExample *&  ex,
const float32_t vec2 
)
virtual

Dot product of an example with a vector

参数
exexample, as VwExample
vec2vector to take dot product with
返回
dot product

在文件 StreamingVwFeatures.cpp306 行定义.

◆ dense_dot() [2/3]

float32_t dense_dot ( const float32_t vec2,
int32_t  vec2_len 
)
virtual

Dot product of current feature vector with a dense vector which stores weights in hashed indices

参数
vec2dense weight vector
vec2_lenlength of weight vector (not used)
返回
dot product

实现了 CStreamingDotFeatures.

在文件 StreamingVwFeatures.cpp317 行定义.

◆ dense_dot() [3/3]

float32_t dense_dot ( SGSparseVector< float32_t > *  vec1,
const float32_t vec2 
)
virtual

Dot product between a dense weight vector and a sparse feature vector. Assumes the features to belong to the constant namespace.

参数
vec1sparse feature vector
vec2weight vector
返回
dot product between dense weights and a sparse feature vector

在文件 StreamingVwFeatures.cpp322 行定义.

◆ dense_dot_range()

void dense_dot_range ( float32_t output,
float32_t alphas,
float32_t vec,
int32_t  dim,
float32_t  b,
int32_t  num_vec = 0 
)
virtualinherited

Compute the dot product for all vectors. This function makes use of dense_dot alphas[i] * sparse[i]^T * w + b

参数
outputresult for the given vector range
alphasscalars to multiply with, may be NULL
vecdense vector to compute dot product with
dimlength of the dense vector
bbias
num_vecnumber of vectors to operate on (indices 0 to num_vec-1)

If num_vec == 0 or left to its default value, the function attempts to return dot product for all vectors. However, the given output vector must be preallocated!

note that the result will be written to output[0...(num_vec-1)] except when num_vec = 0

在文件 StreamingDotFeatures.cpp30 行定义.

◆ dense_dot_truncated()

float32_t dense_dot_truncated ( const float32_t vec2,
VwExample *&  ex,
float32_t  gravity 
)
virtual

Calculate dot product of features with another vector, truncating the elements of that vector by magnitude 'gravity' to a minimum final magnitude of zero.

参数
vec2vector to take dot product with
exexample whose features have to be taken
gravityvalue to use for truncating
返回
dot product

在文件 StreamingVwFeatures.cpp331 行定义.

◆ dot()

float32_t dot ( CStreamingDotFeatures df)
virtual

Dot product taken with another StreamingDotFeatures object.

Currently only works if it is a CStreamingVwFeatures object. It takes the dot product of the current_vectors of both objects.

参数
dfCStreamingDotFeatures object.
返回
Dot product.

实现了 CStreamingDotFeatures.

在文件 StreamingVwFeatures.cpp300 行定义.

◆ duplicate()

CFeatures * duplicate ( ) const
virtual

Duplicate this object

返回
a copy of this object

实现了 CFeatures.

在文件 StreamingVwFeatures.cpp49 行定义.

◆ end_parser()

void end_parser ( )
virtual

Ends the parsing thread.

Waits for the thread to join.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp241 行定义.

◆ equals()

bool equals ( CSGObject other,
float64_t  accuracy = 0.0 
)
virtualinherited

Recursively compares the current SGObject to another one. Compares all registered numerical parameters, recursion upon complex (SGObject) parameters. Does not compare pointers!

May be overwritten but please do with care! Should not be necessary in most cases.

参数
otherobject to compare with
accuracyaccuracy to use for comparison (optional)
返回
true if all parameters were equal, false if not

在文件 SGObject.cpp1177 行定义.

◆ expand_if_required() [1/2]

void expand_if_required ( float32_t *&  vec,
int32_t &  len 
)
virtual

Expand the vector passed so that it its length is equal to the dimensionality of the features. The previous values are kept intact through realloc, and the new ones are set to zero.

参数
vecfloat32_t* vector
lenlength of the vector

重载 CStreamingDotFeatures .

在文件 StreamingVwFeatures.cpp90 行定义.

◆ expand_if_required() [2/2]

void expand_if_required ( float64_t *&  vec,
int32_t &  len 
)
virtual

Expand the vector passed so that it its length is equal to the dimensionality of the features. The previous values are kept intact through realloc, and the new ones are set to zero.

参数
vecfloat64_t* vector
lenlength of the vector

重载 CStreamingDotFeatures .

在文件 StreamingVwFeatures.cpp101 行定义.

◆ free_feature_iterator()

void free_feature_iterator ( void *  iterator)
virtualinherited

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

参数
iteratoras returned by get_first_feature

在文件 StreamingDotFeatures.cpp93 行定义.

◆ get_cache_size()

int32_t get_cache_size ( ) const
inherited

get cache size

返回
cache size

在文件 Features.cpp157 行定义.

◆ get_dim_feature_space()

int32_t get_dim_feature_space ( ) const
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

实现了 CStreamingDotFeatures.

在文件 StreamingVwFeatures.cpp295 行定义.

◆ get_env()

CVwEnvironment * get_env ( )
virtual

Get the environment

返回
environment

在文件 StreamingVwFeatures.cpp78 行定义.

◆ get_example()

VwExample * get_example ( )
virtual

Returns the current example.

返回
current example as VwExample*

在文件 StreamingVwFeatures.cpp266 行定义.

◆ get_feature_class()

EFeatureClass get_feature_class ( ) const
virtual

Return the feature class

返回
C_STREAMING_VW

实现了 CFeatures.

在文件 StreamingVwFeatures.cpp377 行定义.

◆ get_feature_iterator()

void * get_feature_iterator ( )
virtualinherited

iterate over the non-zero features

call get_feature_iterator first, followed by get_next_feature and free_feature_iterator to cleanup

返回
feature iterator (to be passed to get_next_feature)

在文件 StreamingDotFeatures.cpp75 行定义.

◆ get_feature_type()

EFeatureType get_feature_type ( ) const
virtual

Return the feature type, depending on T.

返回
Feature type as EFeatureType

实现了 CFeatures.

在文件 StreamingVwFeatures.cpp133 行定义.

◆ get_global_io()

SGIO * get_global_io ( )
inherited

get the io object

返回
io object

在文件 SGObject.cpp174 行定义.

◆ get_global_parallel()

Parallel * get_global_parallel ( )
inherited

get the parallel object

返回
parallel object

在文件 SGObject.cpp209 行定义.

◆ get_global_version()

Version * get_global_version ( )
inherited

get the version object

返回
version object

在文件 SGObject.cpp222 行定义.

◆ get_has_labels()

bool get_has_labels ( )
virtualinherited

Return whether the examples are labelled or not.

返回
true if labelled, else false

在文件 StreamingFeatures.cpp35 行定义.

◆ get_label()

float64_t get_label ( )
virtual

Return the label of the current example as a float.

Examples must be labelled, otherwise an error occurs.

返回
The label as a float64_t.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp271 行定义.

◆ get_modelsel_names()

SGStringList< char > get_modelsel_names ( )
inherited
返回
vector of names of all parameters which are registered for model selection

在文件 SGObject.cpp1060 行定义.

◆ get_modsel_param_descr()

char * get_modsel_param_descr ( const char *  param_name)
inherited

Returns description of a given parameter string, if it exists. SG_ERROR otherwise

参数
param_namename of the parameter
返回
description of the parameter

在文件 SGObject.cpp1084 行定义.

◆ get_modsel_param_index()

index_t get_modsel_param_index ( const char *  param_name)
inherited

Returns index of model selection parameter with provided index

参数
param_namename of model selection parameter
返回
index of model selection parameter with provided name, -1 if there is no such

在文件 SGObject.cpp1097 行定义.

◆ get_name()

virtual const char* get_name ( ) const
virtual

Return the name.

返回
StreamingVwFeatures

实现了 CSGObject.

在文件 StreamingVwFeatures.h329 行定义.

◆ get_next_example()

bool get_next_example ( )
virtual

Instructs the parser to return the next example.

This example is stored as the current_example in this object.

返回
True on success, false if there are no more examples, or an error occurred.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp246 行定义.

◆ get_next_feature()

bool get_next_feature ( int32_t &  index,
float32_t value,
void *  iterator 
)
virtualinherited

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

在文件 StreamingDotFeatures.cpp87 行定义.

◆ get_nnz_features_for_vector()

int32_t get_nnz_features_for_vector ( )
virtual

get number of non-zero features in vector

返回
number of non-zero features in vector

重载 CStreamingDotFeatures .

在文件 StreamingVwFeatures.cpp120 行定义.

◆ get_num_features()

int32_t get_num_features ( )
virtual

Return the number of features in the current example.

返回
number of features as int

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp372 行定义.

◆ get_num_preprocessed()

int32_t get_num_preprocessed ( ) const
inherited

get the number of applied preprocs

返回
number of applied preprocessors

在文件 Features.cpp100 行定义.

◆ get_num_preprocessors()

int32_t get_num_preprocessors ( ) const
inherited

get number of preprocessors

返回
number of preprocessors

在文件 Features.cpp152 行定义.

◆ get_num_vectors()

int32_t get_num_vectors ( ) const
virtual

Return the number of vectors stored in this object.

返回
1 if current_example exists, else 0.

实现了 CFeatures.

在文件 StreamingVwFeatures.cpp125 行定义.

◆ get_preprocessor()

CPreprocessor * get_preprocessor ( int32_t  num) const
inherited

get specified preprocessor

参数
numindex of preprocessor in list

在文件 Features.cpp90 行定义.

◆ get_streamed_features()

virtual CFeatures* get_streamed_features ( index_t  num_elements)
virtualinherited

Returns a CFeatures instance which contains num_elements elements from the underlying stream

参数
num_elementsnum elements to save from stream
返回
CFeatures object of underlying type, NULL if not enough data

NOT IMPLEMENTED!

CStreamingDenseFeatures< T >, CStreamingDenseFeatures< float64_t > , 以及 CStreamingDenseFeatures< float32_t > 重载.

在文件 StreamingFeatures.h188 行定义.

◆ get_subset_stack()

CSubsetStack * get_subset_stack ( )
virtualinherited

returns subset stack

返回
subset stack

在文件 Features.cpp325 行定义.

◆ has_property()

bool has_property ( EFeatureProperty  p) const
inherited

check if features have given property

参数
pfeature property
返回
if features have given property

在文件 Features.cpp292 行定义.

◆ is_generic()

bool is_generic ( EPrimitiveType *  generic) const
virtualinherited

If the SGSerializable is a class template then TRUE will be returned and GENERIC is set to the type of the generic.

参数
genericset to the type of the generic if returning TRUE
返回
TRUE if a class template.

在文件 SGObject.cpp228 行定义.

◆ is_preprocessed()

bool is_preprocessed ( int32_t  num) const
inherited

get whether specified preprocessor was already applied

参数
numindex of preprocessor in list

在文件 Features.cpp146 行定义.

◆ is_seekable()

bool is_seekable ( )
virtualinherited

Whether the stream is seekable (to check if multiple epochs are possible), i.e., whether we can process examples in a batch fashion.

A stream can usually seekable when it comes from a file or when it comes from another conventional CFeatures object.

返回
true if seekable, else false.

在文件 StreamingFeatures.cpp40 行定义.

◆ list_feature_obj()

void list_feature_obj ( ) const
inherited

list feature object

在文件 Features.cpp168 行定义.

◆ list_preprocessors()

void list_preprocessors ( )
inherited

print preprocessors

在文件 Features.cpp128 行定义.

◆ load()

void load ( CFile loader)
virtualinherited

◆ load_all_file_parameters()

DynArray< TParameter * > * load_all_file_parameters ( int32_t  file_version,
int32_t  current_version,
CSerializableFile file,
const char *  prefix = "" 
)
inherited

maps all parameters of this instance to the provided file version and loads all parameter data from the file into an array, which is sorted (basically calls load_file_parameter(...) for all parameters and puts all results into a sorted array)

参数
file_versionparameter version of the file
current_versionversion from which mapping begins (you want to use Version::get_version_parameter() for this in most cases)
filefile to load from
prefixprefix for members
返回
(sorted) array of created TParameter instances with file data

在文件 SGObject.cpp633 行定义.

◆ load_file_parameters()

DynArray< TParameter * > * load_file_parameters ( const SGParamInfo param_info,
int32_t  file_version,
CSerializableFile file,
const char *  prefix = "" 
)
inherited

loads some specified parameters from a file with a specified version The provided parameter info has a version which is recursively mapped until the file parameter version is reached. Note that there may be possibly multiple parameters in the mapping, therefore, a set of TParameter instances is returned

参数
param_infoinformation of parameter
file_versionparameter version of the file, must be <= provided parameter version
filefile to load from
prefixprefix for members
返回
new array with TParameter instances with the attached data

在文件 SGObject.cpp474 行定义.

◆ load_serializable()

bool load_serializable ( CSerializableFile file,
const char *  prefix = "",
int32_t  param_version = Version::get_version_parameter() 
)
virtualinherited

Load this object from file. If it will fail (returning FALSE) then this object will contain inconsistent data and should not be used!

参数
filewhere to load from
prefixprefix for members
param_version(optional) a parameter version different to (this is mainly for testing, better do not use)
返回
TRUE if done, otherwise FALSE

在文件 SGObject.cpp305 行定义.

◆ load_serializable_post()

void load_serializable_post ( )
throw (ShogunException
)
protectedvirtualinherited

Can (optionally) be overridden to post-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::LOAD_SERIALIZABLE_POST is called.

异常
ShogunExceptionWill be thrown if an error occurres.

CWeightedDegreePositionStringKernel, CKernel, CList, CAlphabet, CLinearHMM, CGaussianKernel, CInverseMultiQuadricKernel, CCircularKernel , 以及 CExponentialKernel 重载.

在文件 SGObject.cpp989 行定义.

◆ load_serializable_pre()

void load_serializable_pre ( )
throw (ShogunException
)
protectedvirtualinherited

Can (optionally) be overridden to pre-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::LOAD_SERIALIZABLE_PRE is called.

异常
ShogunExceptionWill be thrown if an error occurres.

CDynamicArray< T >, CDynamicArray< float64_t >, CDynamicArray< float32_t >, CDynamicArray< int32_t >, CDynamicArray< char >, CDynamicArray< bool > , 以及 CDynamicObjectArray 重载.

在文件 SGObject.cpp984 行定义.

◆ map_parameters()

void map_parameters ( DynArray< TParameter *> *  param_base,
int32_t &  base_version,
DynArray< const SGParamInfo *> *  target_param_infos 
)
inherited

Takes a set of TParameter instances (base) with a certain version and a set of target parameter infos and recursively maps the base level wise to the current version using CSGObject::migrate(...). The base is replaced. After this call, the base version containing parameters should be of same version/type as the initial target parameter infos. Note for this to work, the migrate methods and all the internal parameter mappings have to match

参数
param_baseset of TParameter instances that are mapped to the provided target parameter infos
base_versionversion of the parameter base
target_param_infosset of SGParamInfo instances that specify the target parameter base

在文件 SGObject.cpp671 行定义.

◆ migrate()

TParameter * migrate ( DynArray< TParameter *> *  param_base,
const SGParamInfo target 
)
protectedvirtualinherited

creates a new TParameter instance, which contains migrated data from the version that is provided. The provided parameter data base is used for migration, this base is a collection of all parameter data of the previous version. Migration is done FROM the data in param_base TO the provided param info Migration is always one version step. Method has to be implemented in subclasses, if no match is found, base method has to be called.

If there is an element in the param_base which equals the target, a copy of the element is returned. This represents the case when nothing has changed and therefore, the migrate method is not overloaded in a subclass

参数
param_baseset of TParameter instances to use for migration
targetparameter info for the resulting TParameter
返回
a new TParameter instance with migrated data from the base of the type which is specified by the target parameter

在文件 SGObject.cpp878 行定义.

◆ one_to_one_migration_prepare()

void one_to_one_migration_prepare ( DynArray< TParameter *> *  param_base,
const SGParamInfo target,
TParameter *&  replacement,
TParameter *&  to_migrate,
char *  old_name = NULL 
)
protectedvirtualinherited

This method prepares everything for a one-to-one parameter migration. One to one here means that only ONE element of the parameter base is needed for the migration (the one with the same name as the target). Data is allocated for the target (in the type as provided in the target SGParamInfo), and a corresponding new TParameter instance is written to replacement. The to_migrate pointer points to the single needed TParameter instance needed for migration. If a name change happened, the old name may be specified by old_name. In addition, the m_delete_data flag of to_migrate is set to true. So if you want to migrate data, the only thing to do after this call is converting the data in the m_parameter fields. If unsure how to use - have a look into an example for this. (base_migration_type_conversion.cpp for example)

参数
param_baseset of TParameter instances to use for migration
targetparameter info for the resulting TParameter
replacement(used as output) here the TParameter instance which is returned by migration is created into
to_migratethe only source that is used for migration
old_namewith this parameter, a name change may be specified

在文件 SGObject.cpp818 行定义.

◆ print_modsel_params()

void print_modsel_params ( )
inherited

prints all parameter registered for model selection and their type

在文件 SGObject.cpp1036 行定义.

◆ print_serializable()

void print_serializable ( const char *  prefix = "")
virtualinherited

prints registered parameters out

参数
prefixprefix for members

在文件 SGObject.cpp240 行定义.

◆ real_weight()

float32_t real_weight ( float32_t  w,
float32_t  gravity 
)
virtual

Reduce element 'w' to max(w-gravity, 0)

参数
wvalue to truncate
gravityvalue to truncate using
返回
truncated value

在文件 StreamingVwFeatures.cpp112 行定义.

◆ release_example()

void release_example ( )
virtual

Release the current example, indicating to the parser that it has been processed by the learning algorithm.

The parser is then free to throw away that example.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp278 行定义.

◆ remove_all_subsets()

void remove_all_subsets ( )
virtualinherited

removes all subsets Calls subset_changed_post() afterwards

CCombinedFeatures 重载.

在文件 Features.cpp319 行定义.

◆ remove_subset()

void remove_subset ( )
virtualinherited

removes that last added subset from subset stack, if existing Calls subset_changed_post() afterwards

CCombinedFeatures 重载.

在文件 Features.cpp313 行定义.

◆ reset_stream()

void reset_stream ( )
virtual

Reset the file back to the first example. Only works for cache files.

重载 CStreamingFeatures .

在文件 StreamingVwFeatures.cpp64 行定义.

◆ reshape()

bool reshape ( int32_t  num_features,
int32_t  num_vectors 
)
virtualinherited

in case there is a feature matrix allow for reshaping

NOT IMPLEMENTED!

参数
num_featuresnew number of features
num_vectorsnew number of vectors
返回
if reshaping was successful

CDenseFeatures< ST >, CDenseFeatures< uint32_t >, CDenseFeatures< float64_t >, CDenseFeatures< T > , 以及 CDenseFeatures< uint16_t > 重载.

在文件 Features.cpp162 行定义.

◆ save()

void save ( CFile writer)
virtualinherited

◆ save_serializable()

bool save_serializable ( CSerializableFile file,
const char *  prefix = "",
int32_t  param_version = Version::get_version_parameter() 
)
virtualinherited

Save this object to file.

参数
filewhere to save the object; will be closed during returning if PREFIX is an empty string.
prefixprefix for members
param_version(optional) a parameter version different to (this is mainly for testing, better do not use)
返回
TRUE if done, otherwise FALSE

在文件 SGObject.cpp246 行定义.

◆ save_serializable_post()

void save_serializable_post ( )
throw (ShogunException
)
protectedvirtualinherited

Can (optionally) be overridden to post-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::SAVE_SERIALIZABLE_POST is called.

异常
ShogunExceptionWill be thrown if an error occurres.

CKernel 重载.

在文件 SGObject.cpp999 行定义.

◆ save_serializable_pre()

void save_serializable_pre ( )
throw (ShogunException
)
protectedvirtualinherited

Can (optionally) be overridden to pre-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::SAVE_SERIALIZABLE_PRE is called.

异常
ShogunExceptionWill be thrown if an error occurres.

CKernel, CDynamicArray< T >, CDynamicArray< float64_t >, CDynamicArray< float32_t >, CDynamicArray< int32_t >, CDynamicArray< char >, CDynamicArray< bool > , 以及 CDynamicObjectArray 重载.

在文件 SGObject.cpp994 行定义.

◆ set_env()

void set_env ( CVwEnvironment vw_env)
virtual

Set the environment

参数
vw_envenvironment

在文件 StreamingVwFeatures.cpp84 行定义.

◆ set_generic() [1/16]

void set_generic ( )
inherited

在文件 SGObject.cpp41 行定义.

◆ set_generic() [2/16]

void set_generic ( )
inherited

在文件 SGObject.cpp46 行定义.

◆ set_generic() [3/16]

void set_generic ( )
inherited

在文件 SGObject.cpp51 行定义.

◆ set_generic() [4/16]

void set_generic ( )
inherited

在文件 SGObject.cpp56 行定义.

◆ set_generic() [5/16]

void set_generic ( )
inherited

在文件 SGObject.cpp61 行定义.

◆ set_generic() [6/16]

void set_generic ( )
inherited

在文件 SGObject.cpp66 行定义.

◆ set_generic() [7/16]

void set_generic ( )
inherited

在文件 SGObject.cpp71 行定义.

◆ set_generic() [8/16]

void set_generic ( )
inherited

在文件 SGObject.cpp76 行定义.

◆ set_generic() [9/16]

void set_generic ( )
inherited

在文件 SGObject.cpp81 行定义.

◆ set_generic() [10/16]

void set_generic ( )
inherited

在文件 SGObject.cpp86 行定义.

◆ set_generic() [11/16]

void set_generic ( )
inherited

在文件 SGObject.cpp91 行定义.

◆ set_generic() [12/16]

void set_generic ( )
inherited

在文件 SGObject.cpp96 行定义.

◆ set_generic() [13/16]

void set_generic ( )
inherited

在文件 SGObject.cpp101 行定义.

◆ set_generic() [14/16]

void set_generic ( )
inherited

在文件 SGObject.cpp106 行定义.

◆ set_generic() [15/16]

void set_generic ( )
inherited

在文件 SGObject.cpp111 行定义.

◆ set_generic() [16/16]

void set_generic ( )
inherited

set generic type to T

◆ set_global_io()

void set_global_io ( SGIO io)
inherited

set the io object

参数
ioio object to use

在文件 SGObject.cpp167 行定义.

◆ set_global_parallel()

void set_global_parallel ( Parallel parallel)
inherited

set the parallel object

参数
parallelparallel object to use

在文件 SGObject.cpp180 行定义.

◆ set_global_version()

void set_global_version ( Version version)
inherited

set the version object

参数
versionversion object to use

在文件 SGObject.cpp215 行定义.

◆ set_preprocessed()

void set_preprocessed ( int32_t  num)
inherited

set applied flag for preprocessor

参数
numindex of preprocessor in list

在文件 Features.cpp140 行定义.

◆ set_property()

void set_property ( EFeatureProperty  p)
inherited

set property

参数
pkernel property to set

在文件 Features.cpp297 行定义.

◆ set_read_functions()

void set_read_functions ( )
inherited

Set the vector reading functions.

The functions are implemented specific to the type in the derived class.

在文件 StreamingFeatures.cpp29 行定义.

◆ set_vector_and_label_reader()

void set_vector_and_label_reader ( )
virtual

Sets the read function (in case the examples are labelled) to get_*_vector_and_label from CStreamingFile.

The exact function depends on type T.

The parser uses the function set by this while reading labelled examples.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp59 行定义.

◆ set_vector_reader()

void set_vector_reader ( )
virtual

Sets the read function (in case the examples are unlabelled) to get_*_vector() from CStreamingFile.

The exact function depends on type T.

The parser uses the function set by this while reading unlabelled examples.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp54 行定义.

◆ shallow_copy()

virtual CSGObject* shallow_copy ( ) const
virtualinherited

A shallow copy. All the SGObject instance variables will be simply assigned and SG_REF-ed.

CGaussianKernel 重载.

在文件 SGObject.h117 行定义.

◆ start_parser()

void start_parser ( )
virtual

Starts the parsing thread.

To be called before trying to use any feature vectors from this object.

实现了 CStreamingFeatures.

在文件 StreamingVwFeatures.cpp235 行定义.

◆ subset_changed_post()

virtual void subset_changed_post ( )
virtualinherited

method may be overwritten to update things that depend on subset

CStringFeatures< ST >, CStringFeatures< T >, CStringFeatures< uint8_t >, CStringFeatures< char > , 以及 CStringFeatures< uint16_t > 重载.

在文件 Features.h271 行定义.

◆ unset_generic()

void unset_generic ( )
inherited

unset generic type

this has to be called in classes specializing a template class

在文件 SGObject.cpp235 行定义.

◆ unset_property()

void unset_property ( EFeatureProperty  p)
inherited

unset property

参数
pkernel property to unset

在文件 Features.cpp302 行定义.

◆ update_parameter_hash()

bool update_parameter_hash ( )
virtualinherited

Updates the hash of current parameter combination.

返回
bool if parameter combination has changed since last update.

在文件 SGObject.cpp187 行定义.

类成员变量说明

◆ combined_weight

float32_t combined_weight
protectedinherited

feature weighting in combined dot features

在文件 StreamingDotFeatures.h186 行定义.

◆ current_example

VwExample* current_example
protected

Example currently being processed

在文件 StreamingVwFeatures.h389 行定义.

◆ current_label

float64_t current_label
protected

The current example's label.

在文件 StreamingVwFeatures.h380 行定义.

◆ current_length

int32_t current_length
protected

Number of features in current example.

在文件 StreamingVwFeatures.h383 行定义.

◆ env

CVwEnvironment* env
protected

Environment for VW

在文件 StreamingVwFeatures.h386 行定义.

◆ example_count

vw_size_t example_count
protected

Number of examples processed at a point of time

在文件 StreamingVwFeatures.h377 行定义.

◆ has_labels

bool has_labels
protectedinherited

Whether examples are labelled or not.

在文件 StreamingFeatures.h198 行定义.

◆ io

SGIO* io
inherited

io

在文件 SGObject.h473 行定义.

◆ m_gradient_parameters

Parameter* m_gradient_parameters
inherited

parameters wrt which we can compute gradients

在文件 SGObject.h488 行定义.

◆ m_hash

uint32_t m_hash
inherited

Hash of parameter values

在文件 SGObject.h494 行定义.

◆ m_model_selection_parameters

Parameter* m_model_selection_parameters
inherited

model selection parameters

在文件 SGObject.h485 行定义.

◆ m_parameter_map

ParameterMap* m_parameter_map
inherited

map for different parameter versions

在文件 SGObject.h491 行定义.

◆ m_parameters

Parameter* m_parameters
inherited

parameters

在文件 SGObject.h482 行定义.

◆ m_subset_stack

CSubsetStack* m_subset_stack
protectedinherited

subset used for index transformations

在文件 Features.h302 行定义.

◆ parallel

Parallel* parallel
inherited

parallel

在文件 SGObject.h476 行定义.

◆ parser

CInputParser<VwExample> parser
protected

The parser object, which reads from input and returns parsed example objects.

在文件 StreamingVwFeatures.h374 行定义.

◆ seekable

bool seekable
protectedinherited

Whether the stream is seekable

在文件 StreamingFeatures.h204 行定义.

◆ version

Version* version
inherited

version

在文件 SGObject.h479 行定义.

◆ working_file

CStreamingFile* working_file
protectedinherited

The StreamingFile object to read from.

在文件 StreamingFeatures.h201 行定义.


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

SHOGUN Machine Learning Toolbox - Documentation