SHOGUN
v1.1.0
|
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
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 |
![]() | |
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) |
SGIO * | get_global_io () |
void | set_global_parallel (Parallel *parallel) |
Parallel * | get_global_parallel () |
void | set_global_version (Version *version) |
Version * | get_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_t > | labels |
int32_t | m_num_classes |
Additional Inherited Members | |
![]() | |
SGIO * | io |
Parallel * | parallel |
Version * | version |
Parameter * | m_parameters |
Parameter * | m_model_selection_parameters |
![]() | |
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) |
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.
|
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 |
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.
|
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.
|
virtual |
deletes any set subset
Definition at line 252 of file Labels.cpp.
|
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.
|
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.