This will normalize the labels of a given dataset to 0..N-1. More...
#include <shark/Data/LabelOrder.h>
Public Member Functions | |
LabelOrder () | |
virtual | ~LabelOrder () |
std::string | name () const |
From INameable: return the class name. More... | |
void | normalizeLabels (LabeledData< RealVector, unsigned int > &dataset) |
This will normalize the labels and store the ordering in the member variables. The dataset will afterwards have labels ranging from 0 to N-1, with N the number of classes. This will overwrite any previously stored label ordering in the object. More... | |
void | restoreOriginalLabels (LabeledData< RealVector, unsigned int > &dataset) |
This will restore the original labels of the dataset. This must be called with data compatible the original dataset, so that the labels will fit. The label ordering will not be destroyed after calling this function, so it can be called multiple times, e.g. to testsets or similar data. More... | |
void | getLabelOrder (std::vector< unsigned int > &labelOrder) |
Get label ordering directly. More... | |
void | setLabelOrder (std::vector< unsigned int > const &labelOrder) |
Set label ordering directly. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Protected Attributes | |
std::vector< unsigned int > | m_labelOrder |
This will normalize the labels of a given dataset to 0..N-1.
Definition at line 59 of file LabelOrder.h.
|
inline |
Definition at line 66 of file LabelOrder.h.
|
inlinevirtual |
Definition at line 69 of file LabelOrder.h.
|
inline |
Get label ordering directly.
[out] | labelOrder | vector to store the current label order. |
Definition at line 159 of file LabelOrder.h.
References m_labelOrder.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 73 of file LabelOrder.h.
|
inline |
This will normalize the labels and store the ordering in the member variables. The dataset will afterwards have labels ranging from 0 to N-1, with N the number of classes. This will overwrite any previously stored label ordering in the object.
[in,out] | dataset | dataset that will be relabeled |
Definition at line 84 of file LabelOrder.h.
|
inline |
This will restore the original labels of the dataset. This must be called with data compatible the original dataset, so that the labels will fit. The label ordering will not be destroyed after calling this function, so it can be called multiple times, e.g. to testsets or similar data.
[in,out] | dataset | dataset to relabel (restore labels) |
Definition at line 137 of file LabelOrder.h.
References shark::LabeledData< InputT, LabelT >::labels(), m_labelOrder, shark::LabeledData< InputT, LabelT >::numberOfElements(), and SHARK_RUNTIME_CHECK.
|
inline |
Set label ordering directly.
[in] | labelOrder | vector with the new label order |
Definition at line 169 of file LabelOrder.h.
References m_labelOrder.
|
protected |
Definition at line 177 of file LabelOrder.h.
Referenced by getLabelOrder(), restoreOriginalLabels(), and setLabelOrder().