File loss_decomposable.hpp

namespace boosting
template<typename StatisticType>
class IDecomposableClassificationLoss : public virtual boosting::IClassificationLoss<StatisticType>, public virtual IClassificationEvaluationMeasure<StatisticType>
#include <loss_decomposable.hpp>

Defines an interface for all decomposable loss functions that can be used in classification problems.

Template Parameters:

StatisticType – The type of the gradients and Hessians that are calculated by the loss function

Subclassed by boosting::INonDecomposableClassificationLoss< StatisticType >, boosting::ISparseDecomposableClassificationLoss< StatisticType >

Public Functions

inline virtual ~IDecomposableClassificationLoss() override
virtual void updateDecomposableStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const CContiguousView<StatisticType> &scoreMatrix, CompleteIndexVector::const_iterator indicesBegin, CompleteIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &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

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

  • indicesEnd – 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 updateDecomposableStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const CContiguousView<StatisticType> &scoreMatrix, PartialIndexVector::const_iterator indicesBegin, PartialIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &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

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

  • indicesEnd – 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 updateDecomposableStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const CContiguousView<StatisticType> &scoreMatrix, CompleteIndexVector::const_iterator indicesBegin, CompleteIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &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

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

  • indicesEnd – 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 updateDecomposableStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const CContiguousView<StatisticType> &scoreMatrix, PartialIndexVector::const_iterator indicesBegin, PartialIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &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 template type BinaryCsrView that provides row-wise access to the ground truth of the training examples

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

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

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

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

template<typename StatisticType>
class IDecomposableRegressionLoss : public virtual boosting::IRegressionLoss<StatisticType>, public virtual IRegressionEvaluationMeasure<StatisticType>
#include <loss_decomposable.hpp>

Defines an interface for all decomposable loss functions that can be used in regression problems.

Template Parameters:

StatisticType – The type of the gradients and Hessians that are calculated by the loss function

Subclassed by boosting::INonDecomposableRegressionLoss< StatisticType >

Public Functions

inline virtual ~IDecomposableRegressionLoss() override
virtual void updateDecomposableStatistics(uint32 exampleIndex, const CContiguousView<const float32> &regressionMatrix, const CContiguousView<StatisticType> &scoreMatrix, CompleteIndexVector::const_iterator indicesBegin, CompleteIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &statisticView) const = 0

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

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

  • regressionMatrix – A reference to an object of template type CContiguousView that provides random access to the regression scores of the training examples

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

  • indicesBegin – A CompleteIndexVector::const_iterator to the beginning of the output indices

  • indicesEnd – A CompleteIndexVector::const_iterator to the end of the output indices

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

virtual void updateDecomposableStatistics(uint32 exampleIndex, const CContiguousView<const float32> &regressionMatrix, const CContiguousView<StatisticType> &scoreMatrix, PartialIndexVector::const_iterator indicesBegin, PartialIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &statisticView) const = 0

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

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

  • regressionMatrix – A reference to an object of template type CContiguousView that provides random access to the regression scores of the training examples

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

  • indicesBegin – A PartialIndexVector::const_iterator to the beginning of the output indices

  • indicesEnd – A PartialIndexVector::const_iterator to the end of the output indices

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

virtual void updateDecomposableStatistics(uint32 exampleIndex, const CsrView<const float32> &regressionMatrix, const CContiguousView<StatisticType> &scoreMatrix, CompleteIndexVector::const_iterator indicesBegin, CompleteIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &statisticView) const = 0

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

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

  • regressionMatrix – A reference to an object of type CsrView that provides row-wise access to the regression scores of the training examples

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

  • indicesBegin – A CompleteIndexVector::const_iterator to the beginning of the output indices

  • indicesEnd – A CompleteIndexVector::const_iterator to the end of the output indices

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

virtual void updateDecomposableStatistics(uint32 exampleIndex, const CsrView<const float32> &regressionMatrix, const CContiguousView<StatisticType> &scoreMatrix, PartialIndexVector::const_iterator indicesBegin, PartialIndexVector::const_iterator indicesEnd, CContiguousView<Statistic<StatisticType>> &statisticView) const = 0

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

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

  • regressionMatrix – A reference to an object of type CsrView that provides row-wise access to the regression scores of the training examples

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

  • indicesBegin – A PartialIndexVector::const_iterator to the beginning of the output indices

  • indicesEnd – A PartialIndexVector::const_iterator to the end of the output indices

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

template<typename StatisticType>
class IDecomposableClassificationLossFactory : public virtual IClassificationEvaluationMeasureFactory<StatisticType>, public virtual IDistanceMeasureFactory<StatisticType>
#include <loss_decomposable.hpp>

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

Template Parameters:

StatisticType – The type of the gradients and Hessians that are calculated by the loss function

Subclassed by boosting::INonDecomposableClassificationLossFactory< StatisticType >, boosting::ISparseDecomposableClassificationLossFactory< StatisticType >

Public Functions

inline virtual ~IDecomposableClassificationLossFactory() override
virtual std::unique_ptr<IDecomposableClassificationLoss<StatisticType>> createDecomposableClassificationLoss() const = 0

Creates and returns a new object of type IDecomposableClassificationLoss.

Returns:

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

template<typename StatisticType>
class IDecomposableRegressionLossFactory : public IRegressionEvaluationMeasureFactory<StatisticType>
#include <loss_decomposable.hpp>

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

Template Parameters:

StatisticType – The type of the gradients and Hessians that are calculated by the loss function

Subclassed by boosting::INonDecomposableRegressionLossFactory< StatisticType >

Public Functions

inline virtual ~IDecomposableRegressionLossFactory() override
virtual std::unique_ptr<IDecomposableRegressionLoss<StatisticType>> createDecomposableRegressionLoss() const = 0

Creates and returns a new object of type IDecomposableRegressionLoss.

Returns:

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

class IDecomposableLossConfig : public virtual boosting::ILossConfig
#include <loss_decomposable.hpp>

Defines an interface for all classes that allow to configure a decomposable loss function.

Subclassed by boosting::IDecomposableClassificationLossConfig, boosting::IDecomposableRegressionLossConfig

Public Functions

inline virtual ~IDecomposableLossConfig() override
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

class IDecomposableClassificationLossConfig : public virtual boosting::IDecomposableLossConfig, public virtual boosting::IClassificationLossConfig
#include <loss_decomposable.hpp>

Defines an interface for all classes that allow to configure a decomposable loss function that can be used in classification problems.

Subclassed by boosting::DecomposableLogisticLossConfig, boosting::DecomposableSquaredErrorLossConfig, boosting::ISparseDecomposableClassificationLossConfig

Public Functions

inline virtual ~IDecomposableClassificationLossConfig() override
virtual std::unique_ptr<IPreset<float32>> createDecomposable32BitClassificationPreset() const = 0

Creates and returns a new object of type IPreset<float32>.

Returns:

An unique pointer to an object of type IPreset<float32> that has been created

virtual std::unique_ptr<IPreset<float64>> createDecomposable64BitClassificationPreset() const = 0

Creates and returns a new object of type IPreset<float64>.

Returns:

An unique pointer to an object of type IPreset<float64> that has been created

inline virtual std::unique_ptr<IClassificationLossConfig::IPreset<float32>> create32BitClassificationPreset() const final override

Creates and returns a new object of type IPreset<float32>.

Returns:

An unique pointer to an object of type IPreset<float32> that has been created

inline virtual std::unique_ptr<IClassificationLossConfig::IPreset<float64>> create64BitClassificationPreset() const final override

Creates and returns a new object of type IPreset<float64>.

Returns:

An unique pointer to an object of type IPreset<float64> that has been created

template<typename StatisticType>
class IPreset : public boosting::IClassificationLossConfig::IPreset<StatisticType>
#include <loss_decomposable.hpp>

Provides access to the interface of an IDecomposableClassificationLossConfig, abstracting away certain configuration options that have already been pre-determined.

Template Parameters:

StatisticType – The type that should be used for representing statistics

Subclassed by boosting::ISparseDecomposableClassificationLossConfig::IPreset< StatisticType >

Public Functions

inline virtual ~IPreset() override
virtual std::unique_ptr<IDecomposableClassificationLossFactory<StatisticType>> createDecomposableClassificationLossFactory() const = 0

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

Returns:

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

inline virtual std::unique_ptr<IClassificationEvaluationMeasureFactory<StatisticType>> createClassificationEvaluationMeasureFactory() const final override

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

Returns:

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

inline virtual std::unique_ptr<IDistanceMeasureFactory<StatisticType>> 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

class IDecomposableRegressionLossConfig : public virtual boosting::IDecomposableLossConfig, public virtual boosting::IRegressionLossConfig
#include <loss_decomposable.hpp>

Defines an interface for all classes that allow to configure a decomposable loss function that can be used in regression problems.

Subclassed by boosting::DecomposableSquaredErrorLossConfig

Public Functions

inline virtual ~IDecomposableRegressionLossConfig() override
virtual std::unique_ptr<IPreset<float32>> createDecomposable32BitRegressionPreset() const = 0

Creates and returns a new object of type IPreset<float32>.

Returns:

An unique pointer to an object of type IPreset<float32> that has been created

virtual std::unique_ptr<IPreset<float64>> createDecomposable64BitRegressionPreset() const = 0

Creates and returns a new object of type IPreset<float64>.

Returns:

An unique pointer to an object of type IPreset<float64> that has been created

inline virtual std::unique_ptr<IRegressionLossConfig::IPreset<float32>> create32BitRegressionPreset() const final override

Creates and returns a new object of type IPreset<float32>.

Returns:

An unique pointer to an object of type IPreset<float32> that has been created

inline virtual std::unique_ptr<IRegressionLossConfig::IPreset<float64>> create64BitRegressionPreset() const final override

Creates and returns a new object of type IPreset<float64>.

Returns:

An unique pointer to an object of type IPreset<float64> that has been created

template<typename StatisticType>
class IPreset : public boosting::IRegressionLossConfig::IPreset<StatisticType>
#include <loss_decomposable.hpp>

Provides access to the interface of an IDecomposableRegressionLossConfig, abstracting away certain configuration options that have already been pre-determined.

Template Parameters:

StatisticType – The type that should be used for representing statistics

Public Functions

inline virtual ~IPreset() override
virtual std::unique_ptr<IDecomposableRegressionLossFactory<StatisticType>> createDecomposableRegressionLossFactory() const = 0

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

Returns:

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

inline virtual std::unique_ptr<IRegressionEvaluationMeasureFactory<StatisticType>> createRegressionEvaluationMeasureFactory() const final override

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

Returns:

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