File loss_label_wise_sparse.hpp¶
-
namespace boosting
-
class ISparseLabelWiseLoss : public virtual boosting::ILabelWiseLoss, public ISparseEvaluationMeasure¶
- #include <loss_label_wise_sparse.hpp>
Defines an interface for all (decomposable) loss functions that are applied label-wise and are suited for the use of sparse data structures. To meet this requirement, the gradients and Hessians that are computed by the loss function should be zero, if the prediction for a label is correct.
Public Functions
-
inline virtual ~ISparseLabelWiseLoss() override¶
-
virtual void updateLabelWiseStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const SparseSetView<float64> &scoreMatrix, CompleteIndexVector::const_iterator labelIndicesBegin, CompleteIndexVector::const_iterator labelIndicesEnd, SparseSetView<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 examplesscoreMatrix – A reference to an object of type
SparseSetView
that stores the currently predicted scoreslabelIndicesBegin – A
CompleteIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
CompleteIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
SparseSetView
to be updated
-
virtual void updateLabelWiseStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const SparseSetView<float64> &scoreMatrix, PartialIndexVector::const_iterator labelIndicesBegin, PartialIndexVector::const_iterator labelIndicesEnd, SparseSetView<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 examplesscoreMatrix – A reference to an object of type
SparseSetView
that stores the currently predicted scoreslabelIndicesBegin – A
PartialIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
PartialIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
SparseSetView
to be updated
-
virtual void updateLabelWiseStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const SparseSetView<float64> &scoreMatrix, CompleteIndexVector::const_iterator labelIndicesBegin, CompleteIndexVector::const_iterator labelIndicesEnd, SparseSetView<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 examplesscoreMatrix – A reference to an object of type
SparseSetView
that stores the currently predicted scoreslabelIndicesBegin – A
CompleteIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
CompleteIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
SparseSetView
to be updated
-
virtual void updateLabelWiseStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const SparseSetView<float64> &scoreMatrix, PartialIndexVector::const_iterator labelIndicesBegin, PartialIndexVector::const_iterator labelIndicesEnd, SparseSetView<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 examplesscoreMatrix – A reference to an object of type
SparseSetView
that stores the currently predicted scoreslabelIndicesBegin – A
PartialIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
PartialIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
SparseSetView
to be updated
-
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 examplesscoreMatrix – A reference to an object of type
CContiguousView
that stores the currently predicted scoreslabelIndicesBegin – A
CompleteIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
CompleteIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
CContiguousView
to be updated
-
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 examplesscoreMatrix – A reference to an object of type
CContiguousView
that stores the currently predicted scoreslabelIndicesBegin – A
PartialIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
PartialIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
CContiguousView
to be updated
-
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 examplesscoreMatrix – A reference to an object of type
CContiguousView
that stores the currently predicted scoreslabelIndicesBegin – A
CompleteIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
CompleteIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
CContiguousView
to be updated
-
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 examplesscoreMatrix – A reference to an object of type
CContiguousView
that stores the currently predicted scoreslabelIndicesBegin – A
PartialIndexVector::const_iterator
to the beginning of the label indiceslabelIndicesEnd – A
PartialIndexVector::const_iterator
to the end of the label indicesstatisticView – A reference to an object of type
CContiguousView
to be updated
-
inline virtual ~ISparseLabelWiseLoss() override¶
-
class ISparseLabelWiseLossFactory : public boosting::ILabelWiseLossFactory, public ISparseEvaluationMeasureFactory¶
- #include <loss_label_wise_sparse.hpp>
Defines an interface for all factories that allow to create instances of the type
ISparseLabelWiseLoss
.Public Functions
-
inline virtual ~ISparseLabelWiseLossFactory() override¶
-
virtual std::unique_ptr<ISparseLabelWiseLoss> createSparseLabelWiseLoss() const = 0¶
Creates and returns a new object of type
ISparseLabelWiseLoss
.- Returns:
An unique pointer to an object of type
ISparseLabelWiseLoss
that has been created
-
inline virtual std::unique_ptr<ILabelWiseLoss> createLabelWiseLoss() const final override¶
-
inline std::unique_ptr<ISparseEvaluationMeasure> createSparseEvaluationMeasure() const final override¶
See also
ISparseEvaluationMeasureFactory::createSparseEvaluationMeasure
-
inline virtual ~ISparseLabelWiseLossFactory() override¶
-
class ISparseLabelWiseLossConfig : public boosting::ILabelWiseLossConfig¶
- #include <loss_label_wise_sparse.hpp>
Defines an interface for all classes that allow to configure a (decomposable) loss function that is applied label-wise and is suited for the use of sparse data structures.
Subclassed by boosting::LabelWiseSquaredHingeLossConfig
Public Functions
-
inline virtual ~ISparseLabelWiseLossConfig() override¶
-
virtual std::unique_ptr<ISparseLabelWiseLossFactory> createSparseLabelWiseLossFactory() const = 0¶
Creates and returns a new object of type
ISparseLabelWiseLossFactory
according to the specified configuration.- Returns:
An unique pointer to an object of type
ISparseLabelWiseLossFactory
that has been created
-
inline std::unique_ptr<ISparseEvaluationMeasureFactory> createSparseEvaluationMeasureFactory() const¶
Creates and returns a new object of type
ISparseEvaluationMeasureFactory
according to the specified configuration.- Returns:
An unique pointer to an object of type
ISparseEvaluationMeasureFactory
that has been created
-
inline virtual std::unique_ptr<ILabelWiseLossFactory> createLabelWiseLossFactory() const final override¶
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 bool isSparse() const final 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
-
inline virtual ~ISparseLabelWiseLossConfig() override¶
-
class ISparseLabelWiseLoss : public virtual boosting::ILabelWiseLoss, public ISparseEvaluationMeasure¶