File loss.hpp

namespace boosting
template<typename StatisticType>
class ILoss
#include <loss.hpp>

Defines an interface for all loss functions.

Template Parameters:

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

Subclassed by boosting::IClassificationLoss< StatisticType >, boosting::IRegressionLoss< StatisticType >

Public Types

using statistic_type = StatisticType

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

Public Functions

inline virtual ~ILoss()
template<typename StatisticType>
class IClassificationLoss : public boosting::ILoss<StatisticType>, public IDistanceMeasure<StatisticType>
#include <loss.hpp>

Defines an interface for all 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::IDecomposableClassificationLoss< StatisticType >, boosting::INonDecomposableClassificationLoss< StatisticType >

Public Functions

inline virtual ~IClassificationLoss() override
template<typename StatisticType>
class IRegressionLoss : public boosting::ILoss<StatisticType>
#include <loss.hpp>

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

Template Parameters:

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

Subclassed by boosting::IDecomposableRegressionLoss< StatisticType >, boosting::INonDecomposableRegressionLoss< StatisticType >

Public Functions

inline virtual ~IRegressionLoss()
class ILossConfig
#include <loss.hpp>

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

Subclassed by boosting::IClassificationLossConfig, boosting::IDecomposableLossConfig, boosting::INonDecomposableLossConfig, boosting::IRegressionLossConfig

Public Functions

inline virtual ~ILossConfig()
virtual bool isDecomposable() const = 0

Returns whether the loss function is decomposable or not.

Returns:

True, if the loss function is decomposable, false otherwise

virtual bool isSparse() const = 0

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

virtual float64 getDefaultPrediction() const = 0

Returns the default prediction for an example that is not covered by any rules.

Returns:

The default prediction

class IClassificationLossConfig : public virtual boosting::ILossConfig
#include <loss.hpp>

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

Subclassed by boosting::IDecomposableClassificationLossConfig, boosting::INonDecomposableClassificationLossConfig

Public Functions

inline virtual ~IClassificationLossConfig() override
virtual std::unique_ptr<IClassificationStatisticsProviderFactory> createClassificationStatisticsProviderFactory(const IFeatureMatrix &featureMatrix, const IRowWiseLabelMatrix &labelMatrix, const BlasFactory &blasFactory, const LapackFactory &lapackFactory, bool preferSparseStatistics) const = 0

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

Parameters:
  • featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the feature values of the training examples

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

  • blasFactory – A reference to an object of type BlasFactory that allows to create objects for executing BLAS routines

  • lapackFactory – A reference to an object of type LapackFactory that allows to create objects for executing LAPACK routines

  • preferSparseStatistics – True, if a sparse representation of statistics should be preferred, if possible, false otherwise

Returns:

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

virtual std::unique_ptr<IMarginalProbabilityFunctionFactory> createMarginalProbabilityFunctionFactory() const = 0

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

Returns:

An unique pointer to an object of type IMarginalProbabilityFunctionFactory that has been created or a null pointer, if the loss function does not support the prediction of marginal probabilities

virtual std::unique_ptr<IJointProbabilityFunctionFactory> createJointProbabilityFunctionFactory() const = 0

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

Returns:

An unique pointer to an object of type IJointProbabilityFunctionFactory that has been created to a null pointer, if the loss function does not support the prediction of joint probabilities

virtual std::unique_ptr<IPreset<float32>> create32BitClassificationPreset() 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>> create64BitClassificationPreset() 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

template<typename StatisticType>
class IPreset
#include <loss.hpp>

Provides access to the interface of an IClassificationLossConfig, 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::IDecomposableClassificationLossConfig::IPreset< StatisticType >, boosting::INonDecomposableClassificationLossConfig::IPreset< StatisticType >

Public Functions

inline virtual ~IPreset()
virtual std::unique_ptr<IClassificationEvaluationMeasureFactory<StatisticType>> createClassificationEvaluationMeasureFactory() const = 0

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

virtual std::unique_ptr<IDistanceMeasureFactory<StatisticType>> createDistanceMeasureFactory() const = 0

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 IRegressionLossConfig : public virtual boosting::ILossConfig
#include <loss.hpp>

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

Subclassed by boosting::IDecomposableRegressionLossConfig, boosting::INonDecomposableRegressionLossConfig

Public Functions

inline virtual ~IRegressionLossConfig() override
virtual std::unique_ptr<IRegressionStatisticsProviderFactory> createRegressionStatisticsProviderFactory(const IFeatureMatrix &featureMatrix, const IRowWiseRegressionMatrix &regressionMatrix, const BlasFactory &blasFactory, const LapackFactory &lapackFactory, bool preferSparseStatistics) const = 0

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

Parameters:
  • featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the feature values of the training examples

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

  • blasFactory – A reference to an object of type BlasFactory that allows to create objects for executing BLAS routines

  • lapackFactory – A reference to an object of type LapackFactory that allows to create objects for executing LAPACK routines

  • preferSparseStatistics – True, if a sparse representation of statistics should be preferred, if possible, false otherwise

Returns:

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

virtual std::unique_ptr<IPreset<float32>> create32BitRegressionPreset() 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>> create64BitRegressionPreset() 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

template<typename StatisticType>
class IPreset
#include <loss.hpp>

Provides access to the interface of an IRegressionLossConfig, 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::IDecomposableRegressionLossConfig::IPreset< StatisticType >, boosting::INonDecomposableRegressionLossConfig::IPreset< StatisticType >

Public Functions

inline virtual ~IPreset()
virtual std::unique_ptr<IRegressionEvaluationMeasureFactory<StatisticType>> createRegressionEvaluationMeasureFactory() const = 0

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