File label_matrix_row_wise.hpp

class IRowWiseLabelMatrix : public IOutputMatrix
#include <label_matrix_row_wise.hpp>

Defines an interface for all label matrices that provide access to the ground truth labels of training examples.

Subclassed by ICContiguousLabelMatrix, ICsrLabelMatrix

Public Functions

inline virtual ~IRowWiseLabelMatrix() override
virtual float32 calculateLabelCardinality() const = 0

Calculates and returns the label cardinality, i.e., the average number of relevant labels per example.

Returns:

The label cardinality

virtual std::unique_ptr<LabelVector> createLabelVector(uint32 row) const = 0

Creates and returns a label vector that corresponds to a specific row in the label matrix.

Parameters:

row – The row

Returns:

An unique pointer to an object of type LabelVector that has been created

virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, const SinglePartition &partition, IStatistics &statistics, const EqualWeightVector &exampleWeights) const = 0

Creates and returns a new instance of the class IInstanceSampling, based on the type of this label matrix.

Parameters:
  • factory – A reference to an object of type IClassificationInstanceSamplingFactory that should be used to create the instance

  • partition – A reference to an object of type SinglePartition that provides access to the indices of the training examples that are included in the training set

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

  • exampleWeights – A reference to an object of type EqualWeightVector that provides access to the weights of individual training examples

Returns:

An unique pointer to an object of type IInstanceSampling that has been created

virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, const SinglePartition &partition, IStatistics &statistics, const DenseWeightVector<float32> &exampleWeights) const = 0

Creates and returns a new instance of the class IInstanceSampling, based on the type of this label matrix.

Parameters:
  • factory – A reference to an object of type IClassificationInstanceSamplingFactory that should be used to create the instance

  • partition – A reference to an object of type SinglePartition that provides access to the indices of the training examples that are included in the training set

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

  • exampleWeights – A reference to an object of type DenseWeightVector<float32> that provides access to the weights of individual training examples

Returns:

An unique pointer to an object of type IInstanceSampling that has been created

virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, BiPartition &partition, IStatistics &statistics, const EqualWeightVector &exampleWeights) const = 0

Creates and returns a new instance of the class IInstanceSampling, based on the type of this label matrix.

Parameters:
  • factory – A reference to an object of type IClassificationInstanceSamplingFactory that should be used to create the instance

  • partition – A reference to an object of type BiPartition that provides access to the indices of the training examples that are included in the training set and the holdout set, respectively

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

  • exampleWeights – A reference to an object of type EqualWeightVector that provides access to the weights of individual training examples

Returns:

An unique pointer to an object of type IInstanceSampling that has been created

virtual std::unique_ptr<IInstanceSampling> createInstanceSampling(const IClassificationInstanceSamplingFactory &factory, BiPartition &partition, IStatistics &statistics, const DenseWeightVector<float32> &exampleWeights) const = 0

Creates and returns a new instance of the class IInstanceSampling, based on the type of this label matrix.

Parameters:
  • factory – A reference to an object of type IClassificationInstanceSamplingFactory that should be used to create the instance

  • partition – A reference to an object of type BiPartition that provides access to the indices of the training examples that are included in the training set and the holdout set, respectively

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

  • exampleWeights – A reference to an object of type DenseeWeightVector<float32> that provides access to the weights of individual training examples

Returns:

An unique pointer to an object of type IInstanceSampling that has been created

virtual std::unique_ptr<IPartitionSampling> createPartitionSampling(const IClassificationPartitionSamplingFactory &factory) const = 0

Creates and returns a new instance of the class IPartitionSampling, based on the type of this label matrix.

Parameters:

factory – A reference to an object of type IClassificationPartitionSamplingFactory that should be used to create the instance

Returns:

An unique pointer to an object of type IPartitionSampling that has been created

virtual std::unique_ptr<IStatisticsProvider> createStatisticsProvider(const IClassificationStatisticsProviderFactory &factory) const = 0

Creates and returns a new instance of the class IStatisticsProvider, based on the type of this output matrix.

Parameters:

factory – A reference to an object of type IClassificationStatisticsProviderFactory that should be used to create the instance

Returns:

An unique pointer to an object of type IStatisticsProvider that has been created

virtual std::unique_ptr<IMarginalProbabilityCalibrationModel> fitMarginalProbabilityCalibrationModel(const IMarginalProbabilityCalibrator &probabilityCalibrator, const SinglePartition &partition, const IStatistics &statistics) const = 0

Fits and returns a model for the calibration of marginal probabilities, based on the type of this label matrix.

Parameters:
  • probabilityCalibrator – A reference to an object of type IMarginalProbabilityCalibrator that should be used to fit the calibration model

  • partition – A reference to an object of type SinglePartition that provides access to the indices of the training examples that are included in the training set

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

Returns:

An unique pointer to an object of type IMarginalProbabilityCalibrationModel that has been fit

virtual std::unique_ptr<IMarginalProbabilityCalibrationModel> fitMarginalProbabilityCalibrationModel(const IMarginalProbabilityCalibrator &probabilityCalibrator, BiPartition &partition, const IStatistics &statistics) const = 0

Fits and returns a model for the calibration of marginal probabilities, based on the type of this label matrix.

Parameters:
  • probabilityCalibrator – A reference to an object of type IMarginalProbabilityCalibrator that should be used to fit the calibration model

  • partition – A reference to an object of type BiPartition that provides access to the indices of the training examples that are included in the training set and the holdout set, respectively

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

Returns:

An unique pointer to an object of type IMarginalProbabilityCalibrationModel that has been fit

virtual std::unique_ptr<IJointProbabilityCalibrationModel> fitJointProbabilityCalibrationModel(const IJointProbabilityCalibrator &probabilityCalibrator, const SinglePartition &partition, const IStatistics &statistics) const = 0

Fits and returns a model for the calibration of joint probabilities, based on the type of this label matrix.

Parameters:
  • probabilityCalibrator – A reference to an object of type IJointProbabilityCalibrator that should be used to fit the calibration model

  • partition – A reference to an object of type SinglePartition that provides access to the indices of the training examples that are included in the training set

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

Returns:

An unique pointer to an object of type IJointProbabilityCalibrationModel that has been fit

virtual std::unique_ptr<IJointProbabilityCalibrationModel> fitJointProbabilityCalibrationModel(const IJointProbabilityCalibrator &probabilityCalibrator, BiPartition &partition, const IStatistics &statistics) const = 0

Fits and returns a model for the calibration of joint probabilities, based on the type of this label matrix.

Parameters:
  • probabilityCalibrator – A reference to an object of type IJointProbabilityCalibrator that should be used to fit the calibration model

  • partition – A reference to an object of type BiPartition that provides access to the indices of the training examples that are included in the training set and the holdout set, respectively

  • statistics – A reference to an object of type IStatistics that provides access to statistics about the quality of predictions for training examples

Returns:

An unique pointer to an object of type IJointProbabilityCalibrationModel that has been fit