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

Detailed Description

The class Labels models labels, i.e. class assignments of objects.

Labels here are always real-valued and thus applicable to classification (cf. CClassifier) and regression (cf. CRegression) problems.

(Partly) subset access is supported. Simple use the set_subset(), remove_subset() functions. If done, all calls that work with features are translated to the subset. See comments to find out whether it is supported for that method

Definition at line 35 of file Labels.h.

Inheritance diagram for CLabels:
Inheritance graph
[legend]

Public Member Functions

 CLabels ()
 CLabels (int32_t num_labels)
 CLabels (SGVector< float64_t > src)
 CLabels (CFile *loader)
virtual ~CLabels ()
virtual void load (CFile *loader)
virtual void save (CFile *writer)
bool set_label (int32_t idx, float64_t label)
bool set_int_label (int32_t idx, int32_t label)
float64_t get_label (int32_t idx)
int32_t get_int_label (int32_t idx)
bool is_two_class_labeling ()
int32_t get_num_classes ()
SGVector< float64_tget_labels ()
void set_labels (SGVector< float64_t > v)
void set_to_one ()
SGVector< int32_t > get_int_labels ()
SGVector< float64_tget_classes ()
void set_int_labels (SGVector< int32_t > labels)
int32_t get_num_labels ()
virtual const char * get_name () const
virtual void set_subset (CSubset *subset)
virtual void remove_subset ()
index_t subset_idx_conversion (index_t idx) const
- 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)

Protected Attributes

SGVector< float64_tlabels
int32_t m_num_classes

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- 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)

Constructor & Destructor Documentation

CLabels ( )

default constructor

Definition at line 23 of file Labels.cpp.

CLabels ( int32_t  num_labels)

constructor

Parameters
num_labelsnumber of labels

Definition at line 29 of file Labels.cpp.

CLabels ( SGVector< float64_t src)

constructor

Parameters
srclabels to set

Definition at line 36 of file Labels.cpp.

CLabels ( CFile loader)

constructor

Parameters
loaderFile object via which to load data

Definition at line 53 of file Labels.cpp.

~CLabels ( )
virtual

destructor

Definition at line 60 of file Labels.cpp.

Member Function Documentation

SGVector< float64_t > get_classes ( )

get classes of labels Caller has to clean up

possible with subset

Returns
classes of labels

Definition at line 129 of file Labels.cpp.

int32_t get_int_label ( int32_t  idx)

get INT label

possible with subset

Parameters
idxindex of label to get
Returns
INT value of label

Definition at line 230 of file Labels.cpp.

SGVector< int32_t > get_int_labels ( )

get INT label vector caller has to clean up

possible with subset

Returns
INT labels

Definition at line 152 of file Labels.cpp.

float64_t get_label ( int32_t  idx)

get label

possible with subset

Parameters
idxindex of label to get
Returns
value of label

Definition at line 223 of file Labels.cpp.

SGVector< float64_t > get_labels ( )

get labels

not possible with subset

Returns
labels

Definition at line 144 of file Labels.cpp.

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

Implements CSGObject.

Definition at line 189 of file Labels.h.

int32_t get_num_classes ( )

return number of classes (for multiclass)

possible with subset

Returns
number of classes

Definition at line 118 of file Labels.cpp.

int32_t get_num_labels ( )

get number of labels, depending on whether a subset is set

Returns
number of labels

Definition at line 240 of file Labels.cpp.

bool is_two_class_labeling ( )

is two-class labeling

possible with subset

Returns
if this is two-class labeling

Definition at line 89 of file Labels.cpp.

void load ( CFile loader)
virtual

load labels from file

any subset is removed before

Parameters
loaderFile object via which to load data

Definition at line 174 of file Labels.cpp.

void remove_subset ( )
virtual

deletes any set subset

Definition at line 252 of file Labels.cpp.

void save ( CFile writer)
virtual

save labels to file

not possible with subset

Parameters
writerFile object via which to save data

Definition at line 187 of file Labels.cpp.

bool set_int_label ( int32_t  idx,
int32_t  label 
)

set INT label

possible with subset

Parameters
idxindex of label to set
labelINT value of label
Returns
if setting was successful

Definition at line 211 of file Labels.cpp.

void set_int_labels ( SGVector< int32_t >  labels)

set INT labels caller has to clean up

not possible on subset

Parameters
labelsINT labels

Definition at line 162 of file Labels.cpp.

bool set_label ( int32_t  idx,
float64_t  label 
)

set label

possible with subset

Parameters
idxindex of label to set
labelvalue of label
Returns
if setting was successful

Definition at line 199 of file Labels.cpp.

void set_labels ( SGVector< float64_t v)

set labels

not possible with subset

Parameters
vlabels

Definition at line 79 of file Labels.cpp.

void set_subset ( CSubset subset)
virtual

setter for subset variable, deletes old one

Parameters
subsetsubset instance to set

Definition at line 245 of file Labels.cpp.

void set_to_one ( )

set all labels to +1

possible with subset

Definition at line 45 of file Labels.cpp.

index_t subset_idx_conversion ( index_t  idx) const

does subset index conversion with the underlying subset if possible

Parameters
idxindex to convert
Returns
converted index

Definition at line 257 of file Labels.cpp.

Member Data Documentation

SGVector<float64_t> labels
protected

the label vector

Definition at line 212 of file Labels.h.

int32_t m_num_classes
protected

number of classes

Definition at line 215 of file Labels.h.


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

SHOGUN Machine Learning Toolbox - Documentation