PLSSVM - Parallel Least Squares Support Vector Machine
2.0.0
A Least Squares Support Vector Machine implementation using different backends.
|
Implements all necessary functionality to map arbitrary labels to labels usable by the C-SVMs. More...
#include <data_set.hpp>
Public Member Functions | |
label_mapper (const std::vector< label_type > &labels) | |
Create a mapping from all labels to { -1 , 1 } and vice versa. More... | |
const real_type & | get_mapped_value_by_label (const label_type &label) const |
Given the original label value, return the mapped label value. More... | |
const label_type & | get_label_by_mapped_value (const real_type &mapped_value) const |
Given the mapped label value, return the original label value. More... | |
size_type | num_mappings () const noexcept |
Returns the number of valid mappings. This is equivalent to the number of different labels. More... | |
std::vector< label_type > | labels () const |
Return a vector containing the different, original labels of the current data set. More... | |
Private Attributes | |
std::map< label_type, real_type > | label_to_mapped_ {} |
A mapping from the label to its mapped value, i.e., { -1 , 1 }. | |
std::map< real_type, label_type > | mapped_to_label_ {} |
A mapping from the mapped value, i.e., { -1 , 1 } to the original label value. | |
Implements all necessary functionality to map arbitrary labels to labels usable by the C-SVMs.
Currently maps all labels to { -1 , 1 }.
|
explicit |
Create a mapping from all labels to { -1 , 1 } and vice versa.
[in] | labels | the labels to map |
plssvm::data_set_exception | if not exatcly two different labels are provided |
auto plssvm::data_set< T, U >::label_mapper::get_mapped_value_by_label | ( | const label_type & | label | ) | const |
Given the original label value, return the mapped label value.
[in] | label | the original label value |
plssvm::data_set_exception | if the original label value does not exist in this mapping |
[[nodiscard]]
) auto plssvm::data_set< T, U >::label_mapper::get_label_by_mapped_value | ( | const real_type & | mapped_value | ) | const |
Given the mapped label value, return the original label value.
[in] | mapped_value | the mapped label value |
plssvm::data_set_exception | if the mapped label value does not exist in this mapping |
[[nodiscard]]
)
|
noexcept |
Returns the number of valid mappings. This is equivalent to the number of different labels.
[[nodiscard]]
) auto plssvm::data_set< T, U >::label_mapper::labels |
Return a vector containing the different, original labels of the current data set.
[[nodiscard]]
)