File loss_label_wise.hpp

namespace boosting
class ILabelWiseLoss : public boosting::ILoss
#include <loss_label_wise.hpp>

Defines an interface for all (decomposable) loss functions that are applied label-wise.

Subclassed by boosting::IExampleWiseLoss, boosting::ISparseLabelWiseLoss

Public Functions

inline virtual ~ILabelWiseLoss() override
virtual void updateLabelWiseStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const CContiguousView<float64> &scoreMatrix, CompleteIndexVector::const_iterator labelIndicesBegin, CompleteIndexVector::const_iterator labelIndicesEnd, CContiguousView<Tuple<float64>> &statisticView) const = 0

Updates the statistics of the example at a specific index, considering only the labels, whose indices are provided by a CompleteIndexVector.

Parameters:
  • exampleIndex – The index of the example for which the gradients and Hessians should be updated

  • labelMatrix – A reference to an object of type CContiguousView that provides random access to the labels of the training examples

  • scoreMatrix – A reference to an object of type CContiguousView that stores the currently predicted scores

  • labelIndicesBegin – A CompleteIndexVector::const_iterator to the beginning of the label indices

  • labelIndicesEnd – A CompleteIndexVector::const_iterator to the end of the label indices

  • statisticView – A reference to an object of type CContiguousView to be updated

virtual void updateLabelWiseStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const CContiguousView<float64> &scoreMatrix, PartialIndexVector::const_iterator labelIndicesBegin, PartialIndexVector::const_iterator labelIndicesEnd, CContiguousView<Tuple<float64>> &statisticView) const = 0

Updates the statistics of the example at a specific index, considering only the labels, whose indices are provided by a PartialIndexVector.

Parameters:
  • exampleIndex – The index of the example for which the gradients and Hessians should be updated

  • labelMatrix – A reference to an object of type CContiguousView that provides random access to the labels of the training examples

  • scoreMatrix – A reference to an object of type CContiguousView that stores the currently predicted scores

  • labelIndicesBegin – A PartialIndexVector::const_iterator to the beginning of the label indices

  • labelIndicesEnd – A PartialIndexVector::const_iterator to the end of the label indices

  • statisticView – A reference to an object of type CContiguousView to be updated

virtual void updateLabelWiseStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const CContiguousView<float64> &scoreMatrix, CompleteIndexVector::const_iterator labelIndicesBegin, CompleteIndexVector::const_iterator labelIndicesEnd, CContiguousView<Tuple<float64>> &statisticView) const = 0

Updates the statistics of the example at a specific index, considering only the labels, whose indices are provided by a CompleteIndexVector.

Parameters:
  • exampleIndex – The index of the example for which the gradients and Hessians should be updated

  • labelMatrix – A reference to an object of type BinaryCsrView that provides row-wise access to the labels of the training examples

  • scoreMatrix – A reference to an object of type CContiguousView that stores the currently predicted scores

  • labelIndicesBegin – A CompleteIndexVector::const_iterator to the beginning of the label indices

  • labelIndicesEnd – A CompleteIndexVector::const_iterator to the end of the label indices

  • statisticView – A reference to an object of type CContiguousView to be updated

virtual void updateLabelWiseStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const CContiguousView<float64> &scoreMatrix, PartialIndexVector::const_iterator labelIndicesBegin, PartialIndexVector::const_iterator labelIndicesEnd, CContiguousView<Tuple<float64>> &statisticView) const = 0

Updates the statistics of the example at a specific index, considering only the labels, whose indices are provided by a PartialIndexVector.

Parameters:
  • exampleIndex – The index of the example for which the gradients and Hessians should be updated

  • labelMatrix – A reference to an object of type BinaryCsrView that provides row-wise access to the labels of the training examples

  • scoreMatrix – A reference to an object of type CContiguousView that stores the currently predicted scores

  • labelIndicesBegin – A PartialIndexVector::const_iterator to the beginning of the label indices

  • labelIndicesEnd – A PartialIndexVector::const_iterator to the end of the label indices

  • statisticView – A reference to an object of type CContiguousView to be updated

class ILabelWiseLossFactory : public IEvaluationMeasureFactory, public IDistanceMeasureFactory
#include <loss_label_wise.hpp>

Defines an interface for all factories that allow to create instances of the type ILabelWiseLoss.

Subclassed by boosting::IExampleWiseLossFactory, boosting::ISparseLabelWiseLossFactory

Public Functions

inline virtual ~ILabelWiseLossFactory() override
virtual std::unique_ptr<ILabelWiseLoss> createLabelWiseLoss() const = 0

Creates and returns a new object of type ILabelWiseLoss.

Returns:

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

inline std::unique_ptr<IEvaluationMeasure> createEvaluationMeasure() const final override

See also

IEvaluationMeasureFactory::createEvaluationMeasure

inline std::unique_ptr<IDistanceMeasure> createDistanceMeasure(const IMarginalProbabilityCalibrationModel &marginalProbabilityCalibrationModel, const IJointProbabilityCalibrationModel &jointProbabilityCalibrationModel) const final override

See also

IDistanceMeasureFactory::createDistanceMeasure

class ILabelWiseLossConfig : public boosting::ILossConfig
#include <loss_label_wise.hpp>

Defines an interface for all classes that allow to configure a (decomposable) loss function that is applied label-wise.

Subclassed by boosting::ISparseLabelWiseLossConfig, boosting::LabelWiseLogisticLossConfig, boosting::LabelWiseSquaredErrorLossConfig

Public Functions

inline virtual ~ILabelWiseLossConfig() override
virtual std::unique_ptr<ILabelWiseLossFactory> createLabelWiseLossFactory() const = 0

Creates and returns a new object of type ILabelWiseLossFactory according to the specified configuration.

Returns:

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

inline virtual std::unique_ptr<IEvaluationMeasureFactory> createEvaluationMeasureFactory() const final override

Creates and returns a new object of type IEvaluationMeasureFactory according to the specified configuration.

Returns:

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

inline virtual std::unique_ptr<IDistanceMeasureFactory> createDistanceMeasureFactory() const final override

Creates and returns a new object of type IDistanceMeasureFactory according to the specified configuration.

Returns:

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

inline virtual bool isDecomposable() const final override

Returns whether the loss function is decomposable or not.

Returns:

True, if the loss function is decomposable, false otherwise

inline virtual bool isSparse() const override

Returns whether the loss function supports to use a sparse format for storing statistics or not.

Returns:

True, if the loss function supports to use a sparse format for storing statistics, false otherwise