DiSMEC++
|
#include <data.h>
Public Member Functions | |
MultiLabelData (SparseFeatures x, std::vector< std::vector< long >> y) | |
MultiLabelData (DenseFeatures x, std::vector< std::vector< long >> y) | |
long | num_labels () const noexcept override |
void | get_labels (label_id_t label, Eigen::Ref< BinaryLabelVector > target) const override |
long | num_positives (label_id_t id) const override |
long | num_negatives (label_id_t id) const override |
const std::vector< long > & | get_label_instances (label_id_t label) const |
void | select_labels (label_id_t start, label_id_t end) |
const std::vector< std::vector< long > > & | all_labels () const |
Public Member Functions inherited from dismec::DatasetBase | |
virtual | ~DatasetBase ()=default |
DatasetBase (const DatasetBase &)=default | |
DatasetBase (DatasetBase &&)=default | |
DatasetBase & | operator= (DatasetBase &&)=default |
DatasetBase & | operator= (const DatasetBase &)=default |
std::shared_ptr< const GenericFeatureMatrix > | get_features () const |
get a shared pointer to the (immutable) feature data More... | |
std::shared_ptr< GenericFeatureMatrix > | edit_features () |
get a shared pointer to mutable feature data. Use with care. More... | |
long | num_features () const noexcept |
Get the total number of features, i.e. the number of columns in the feature matrix. More... | |
long | num_examples () const noexcept |
Get the total number of instances, i.e. the number of rows in the feature matrix. More... | |
std::shared_ptr< const BinaryLabelVector > | get_labels (label_id_t id) const |
Private Attributes | |
std::vector< std::vector< long > > | m_Labels |
Additional Inherited Members | |
Protected Member Functions inherited from dismec::DatasetBase | |
DatasetBase (SparseFeatures x) | |
DatasetBase (DenseFeatures x) | |
Protected Attributes inherited from dismec::DatasetBase | |
std::shared_ptr< GenericFeatureMatrix > | m_Features |
|
inline |
|
inline |
|
inline |
const std::vector< long > & MultiLabelData::get_label_instances | ( | label_id_t | label | ) | const |
Definition at line 72 of file data.cpp.
References m_Labels, and dismec::opaque_int_type< Tag, T >::to_index().
Referenced by dismec::io::save_xmc_dataset().
|
overridevirtual |
Gets the label vector (encoded as dense vector with elements from {-1, 1}) for the id
'th class. The weights will be put into the given target
buffer. Throws std::out_of_bounds, if id is not in [0, num_labels())
.
Implements dismec::DatasetBase.
Definition at line 63 of file data.cpp.
References m_Labels, and dismec::opaque_int_type< Tag, T >::to_index().
|
overridevirtualnoexcept |
Gets the total number of different labels in the dataset. TODO call this num_classes instead?
Implements dismec::DatasetBase.
Definition at line 59 of file data.cpp.
References m_Labels, and dismec::ssize().
Referenced by dismec::io::save_xmc_dataset(), and select_labels().
|
overridevirtual |
Gets the number of instances where label id
is absent (=-1) Throws std::out_of_bounds, if id is not in [0, num_labels())
.
Reimplemented from dismec::DatasetBase.
Definition at line 80 of file data.cpp.
References m_Labels, dismec::DatasetBase::num_examples(), and dismec::ssize().
|
overridevirtual |
Gets the number of instances where label id
is present (=+1) Throws std::out_of_bounds, if id is not in [0, num_labels())
.
Reimplemented from dismec::DatasetBase.
Definition at line 76 of file data.cpp.
References m_Labels, and dismec::ssize().
void MultiLabelData::select_labels | ( | label_id_t | start, |
label_id_t | end | ||
) |
Definition at line 84 of file data.cpp.
References m_Labels, num_labels(), and dismec::opaque_int_type< Tag, T >::to_index().
|
private |
Definition at line 111 of file data.h.
Referenced by get_label_instances(), get_labels(), num_labels(), num_negatives(), num_positives(), and select_labels().