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 37 of file Labels.h.

Inheritance diagram for CLabels:
Inheritance graph
[legend]

List of all members.

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

Protected Attributes

SGVector< float64_tlabels
int32_t m_num_classes

Constructor & Destructor Documentation

CLabels (  ) 

default constructor

Definition at line 23 of file Labels.cpp.

CLabels ( int32_t  num_labels  ) 

constructor

Parameters:
num_labels number of labels

Definition at line 29 of file Labels.cpp.

CLabels ( SGVector< float64_t src  ) 

constructor

Parameters:
src labels to set

Definition at line 36 of file Labels.cpp.

CLabels ( CFile loader  ) 

constructor

Parameters:
loader File 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:
idx index of label to get
Returns:
INT value of label

Definition at line 141 of file Labels.h.

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:
idx index of label to get
Returns:
value of label

Definition at line 127 of file Labels.h.

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 ( void   )  const [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 227 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 221 of file Labels.h.

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:
loader File 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 206 of file Labels.cpp.

void save ( CFile writer  )  [virtual]

save labels to file

not possible with subset

Parameters:
writer File 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:
idx index of label to set
label INT value of label
Returns:
if setting was successful

Definition at line 108 of file Labels.h.

void set_int_labels ( SGVector< int32_t >  labels  ) 

set INT labels caller has to clean up

not possible on subset

Parameters:
labels INT labels

Definition at line 162 of file Labels.cpp.

bool set_label ( int32_t  idx,
float64_t  label 
)

set label

possible with subset

Parameters:
idx index of label to set
label value of label
Returns:
if setting was successful

Definition at line 88 of file Labels.h.

void set_labels ( SGVector< float64_t v  ) 

set labels

not possible with subset

Parameters:
v labels

Definition at line 79 of file Labels.cpp.

void set_subset ( CSubset subset  )  [virtual]

setter for subset variable, deletes old one

Parameters:
subset subset instance to set

Definition at line 199 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:
idx index to convert
Returns:
converted index

Definition at line 243 of file Labels.h.


Member Data Documentation

SGVector<float64_t> labels [protected]

the label vector

Definition at line 253 of file Labels.h.

int32_t m_num_classes [protected]

number of classes

Definition at line 256 of file Labels.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation