SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
CAttributeFeatures Class Referenceabstract

Detailed Description

Implements attributed features, that is in the simplest case a number of (attribute, value) pairs.

For example

x[0...].attr1 = <value(s)> x[0...].attr2 = <value(s)>.

A more complex example would be nested structures x[0...].attr1[0...].subattr1 = ..

This might be used to represent (attr, value) pairs, simple structures, trees ...

Definition at line 44 of file AttributeFeatures.h.

Inheritance diagram for CAttributeFeatures:
Inheritance graph
[legend]

Public Member Functions

 CAttributeFeatures ()
 
virtual ~CAttributeFeatures ()
 
CFeaturesget_attribute (char *attr_name)
 
void get_attribute_by_index (int idx, const char *&attr_name, CFeatures *&attr_obj)
 
bool set_attribute (char *attr_name, CFeatures *attr_obj)
 
bool del_attribute (char *attr_name)
 
int32_t get_num_attributes ()
 
virtual const char * get_name () const
 
virtual CFeaturesduplicate () const =0
 
virtual EFeatureType get_feature_type ()=0
 
virtual EFeatureClass get_feature_class ()=0
 
virtual int32_t get_num_vectors () const =0
 
virtual int32_t get_size ()=0
 
- Public Member Functions inherited from CFeatures
 CFeatures (int32_t size=0)
 
 CFeatures (const CFeatures &orig)
 
 CFeatures (CFile *loader)
 
virtual ~CFeatures ()
 
virtual int32_t add_preprocessor (CPreprocessor *p)
 set preprocessor More...
 
virtual CPreprocessordel_preprocessor (int32_t num)
 del current preprocessor More...
 
CPreprocessorget_preprocessor (int32_t num)
 get current preprocessor More...
 
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 More...
 
int32_t get_num_preprocessors () const
 
void clean_preprocessors ()
 clears all preprocs More...
 
int32_t get_cache_size ()
 
virtual bool reshape (int32_t num_features, int32_t num_vectors)
 
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)
 
- Public Member Functions inherited from CSGObject
 CSGObject ()
 
 CSGObject (const CSGObject &orig)
 
virtual ~CSGObject ()
 
virtual bool is_generic (EPrimitiveType *generic) const
 
template<class T >
void set_generic ()
 
void unset_generic ()
 
virtual void print_serializable (const char *prefix="")
 
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
 
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
 
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 ()
 
SGVector< char * > get_modelsel_names ()
 
char * get_modsel_param_descr (const char *param_name)
 
index_t get_modsel_param_index (const char *param_name)
 
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 ()
 

Protected Member Functions

int32_t find_attr_index (char *attr_name)
 
- Protected Member Functions inherited from CSGObject
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 Attributes

DynArray< T_ATTRIBUTE > features
 list of attributes (sorted) More...
 
- Protected Attributes inherited from CFeatures
CSubsetm_subset
 

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
 
Parallelparallel
 
Versionversion
 
Parameterm_parameters
 
Parameterm_model_selection_parameters
 

Constructor & Destructor Documentation

default constructor

Definition at line 19 of file AttributeFeatures.cpp.

~CAttributeFeatures ( )
virtual

destructor

Definition at line 91 of file AttributeFeatures.cpp.

Member Function Documentation

bool del_attribute ( char *  attr_name)

delete the attribute matching attribute name

Parameters
attr_nameattribute name
Returns
true on success

Definition at line 60 of file AttributeFeatures.cpp.

virtual CFeatures* duplicate ( ) const
pure virtual

duplicate feature object

abstract base method

Returns
feature object

Implements CFeatures.

int32_t find_attr_index ( char *  attr_name)
protected

find the index of the attribute matching attribute name

Parameters
attr_nameattribute name
Returns
index (if found), otherwise -1

Definition at line 79 of file AttributeFeatures.cpp.

CFeatures * get_attribute ( char *  attr_name)

return the feature object matching attribute name

Parameters
attr_nameattribute name
Returns
feature object

Definition at line 24 of file AttributeFeatures.cpp.

void get_attribute_by_index ( int  idx,
const char *&  attr_name,
CFeatures *&  attr_obj 
)

return the feature object at index

Parameters
idxindex of attribute
attr_nameattribute name (returned by reference)
attr_objattribute object (returned by reference)

Definition at line 37 of file AttributeFeatures.cpp.

virtual EFeatureClass get_feature_class ( )
pure virtual

get feature class

abstract base method

Returns
feature class like STRING, SIMPLE, SPARSE...

Implements CFeatures.

virtual EFeatureType get_feature_type ( )
pure virtual

get feature type

abstract base method

Returns
templated feature type

Implements CFeatures.

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 91 of file AttributeFeatures.h.

int32_t get_num_attributes ( )

get number of attributes

Returns
number of attributes

Definition at line 74 of file AttributeFeatures.cpp.

virtual int32_t get_num_vectors ( ) const
pure virtual

get number of examples/vectors

abstract base method

Returns
number of examples/vectors

Implements CFeatures.

virtual int32_t get_size ( )
pure virtual

get memory footprint of one feature

abstract base method

Returns
memory footprint of one feature

Implements CFeatures.

bool set_attribute ( char *  attr_name,
CFeatures attr_obj 
)

set the feature object for attribute name

Parameters
attr_nameattribute name
attr_objfeature object to set
Returns
true on success

Definition at line 45 of file AttributeFeatures.cpp.

Member Data Documentation

DynArray<T_ATTRIBUTE> features
protected

list of attributes (sorted)

Definition at line 143 of file AttributeFeatures.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation