DiSMEC++
dismec::BinaryData Class Reference

Collects the data related to a single optimization problem. More...

#include <data.h>

Inheritance diagram for dismec::BinaryData:
dismec::DatasetBase

Public Member Functions

 BinaryData (SparseFeatures x, std::shared_ptr< BinaryLabelVector > y)
 
long num_labels () const noexcept override
 
void get_labels (label_id_t i, Eigen::Ref< BinaryLabelVector > target) const override
 
- Public Member Functions inherited from dismec::DatasetBase
virtual ~DatasetBase ()=default
 
 DatasetBase (const DatasetBase &)=default
 
 DatasetBase (DatasetBase &&)=default
 
DatasetBaseoperator= (DatasetBase &&)=default
 
DatasetBaseoperator= (const DatasetBase &)=default
 
std::shared_ptr< const GenericFeatureMatrixget_features () const
 get a shared pointer to the (immutable) feature data More...
 
std::shared_ptr< GenericFeatureMatrixedit_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...
 
virtual long num_positives (label_id_t id) const
 
virtual long num_negatives (label_id_t id) const
 
std::shared_ptr< const BinaryLabelVectorget_labels (label_id_t id) const
 

Private Attributes

std::shared_ptr< BinaryLabelVectorm_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< GenericFeatureMatrixm_Features
 

Detailed Description

Collects the data related to a single optimization problem.

This contains the entire training set as sparse features, so we require that this fit into memory. The lables are strored as a dense vector.

Definition at line 69 of file data.h.

Constructor & Destructor Documentation

◆ BinaryData()

dismec::BinaryData::BinaryData ( SparseFeatures  x,
std::shared_ptr< BinaryLabelVector y 
)
inline

Definition at line 71 of file data.h.

Member Function Documentation

◆ get_labels()

void BinaryData::get_labels ( label_id_t  id,
Eigen::Ref< BinaryLabelVector target 
) const
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 28 of file data.cpp.

References m_Labels.

◆ num_labels()

long BinaryData::num_labels ( ) const
overridevirtualnoexcept

Gets the total number of different labels in the dataset. TODO call this num_classes instead?

Implements dismec::DatasetBase.

Definition at line 35 of file data.cpp.

Member Data Documentation

◆ m_Labels

std::shared_ptr<BinaryLabelVector> dismec::BinaryData::m_Labels
private

Definition at line 82 of file data.h.

Referenced by get_labels().


The documentation for this class was generated from the following files: