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.
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_t > | get_labels () |
void | set_labels (SGVector< float64_t > v) |
void | set_to_one () |
SGVector< int32_t > | get_int_labels () |
SGVector< float64_t > | get_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_t > | labels |
int32_t | m_num_classes |
CLabels | ( | ) |
default constructor
Definition at line 23 of file Labels.cpp.
CLabels | ( | int32_t | num_labels | ) |
constructor
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.
get classes of labels Caller has to clean up
possible with subset
Definition at line 129 of file Labels.cpp.
int32_t get_int_label | ( | int32_t | idx | ) |
get INT label
possible with subset
idx | index of label to get |
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
Definition at line 152 of file Labels.cpp.
float64_t get_label | ( | int32_t | idx | ) |
get label
possible with subset
idx | index of label to get |
Definition at line 223 of file Labels.cpp.
virtual const char* get_name | ( | ) | const [virtual] |
int32_t get_num_classes | ( | ) |
return number of classes (for multiclass)
possible with subset
Definition at line 118 of file Labels.cpp.
int32_t get_num_labels | ( | ) |
get number of labels, depending on whether a subset is set
Definition at line 240 of file Labels.cpp.
bool is_two_class_labeling | ( | ) |
is two-class labeling
possible with subset
Definition at line 89 of file Labels.cpp.
void load | ( | CFile * | loader | ) | [virtual] |
load labels from file
any subset is removed before
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 252 of file Labels.cpp.
void save | ( | CFile * | writer | ) | [virtual] |
save labels to file
not possible with subset
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
idx | index of label to set | |
label | INT value of label |
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
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
idx | index of label to set | |
label | value of label |
Definition at line 199 of file Labels.cpp.
void set_subset | ( | CSubset * | subset | ) | [virtual] |
setter for subset variable, deletes old one
subset | subset instance to set |
Definition at line 245 of file Labels.cpp.
void set_to_one | ( | ) |
does subset index conversion with the underlying subset if possible
idx | index to convert |
Definition at line 257 of file Labels.cpp.
int32_t m_num_classes [protected] |