File loss_example_wise.hpp

namespace boosting
class IExampleWiseLoss : public boosting::ILabelWiseLoss
#include <loss_example_wise.hpp>

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

Public Functions

inline virtual ~IExampleWiseLoss() override
virtual void updateExampleWiseStatistics(uint32 exampleIndex, const CContiguousView<const uint8> &labelMatrix, const CContiguousView<float64> &scoreMatrix, DenseExampleWiseStatisticView &statisticView) const = 0

Updates the statistics of the example at a specific index.

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

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

virtual void updateExampleWiseStatistics(uint32 exampleIndex, const BinaryCsrView &labelMatrix, const CContiguousView<float64> &scoreMatrix, DenseExampleWiseStatisticView &statisticView) const = 0

Updates the statistics of the example at a specific index.

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

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

class IExampleWiseLossFactory : public boosting::ILabelWiseLossFactory
#include <loss_example_wise.hpp>

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

Public Functions

inline virtual ~IExampleWiseLossFactory() override
virtual std::unique_ptr<IExampleWiseLoss> createExampleWiseLoss() const = 0

Creates and returns a new object of type IExampleWiseLoss.

Returns:

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

inline virtual std::unique_ptr<ILabelWiseLoss> createLabelWiseLoss() const final override

Creates and returns a new object of type ILabelWiseLoss.

Returns:

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

class IExampleWiseLossConfig : public boosting::ILossConfig
#include <loss_example_wise.hpp>

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

Subclassed by boosting::ExampleWiseLogisticLossConfig, boosting::ExampleWiseSquaredErrorLossConfig, boosting::ExampleWiseSquaredHingeLossConfig

Public Functions

inline virtual ~IExampleWiseLossConfig() override
virtual std::unique_ptr<IExampleWiseLossFactory> createExampleWiseLossFactory() const = 0

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

Returns:

An unique pointer to an object of type IExampleWiseLossFactory 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