File label_binning.hpp

namespace boosting
template<typename CriterionType>
struct LabelInfo
#include <label_binning.hpp>

Stores information about a vector that provides access to the binning criteria for individual labels. This includes the number of positive and negative bins, the labels should be assigned to, as well as the minimum and maximum criterion in the vector.

Public Members

uint32 numPositiveBins

The number of positive bins.

CriterionType minPositive

The minimum among all statistics that belong to the positive bins.

CriterionType maxPositive

The maximum among all statistics that belong to the positive bins.

uint32 numNegativeBins

The number of negative bins.

CriterionType minNegative

The minimum among all statistics that belong to the negative bins.

CriterionType maxNegative

The maximum among all statistics that belong to the negative bins.

template<typename CriteriaType>
class ILabelBinning
#include <label_binning.hpp>

Defines an interface for methods that assign labels to bins, based on corresponding criteria.

Template Parameters:

CriteriaType – The type of the criteria

Public Types

using Callback = std::function<void(uint32 binIndex, uint32 labelIndex)>

A callback function that is invoked when a label is assigned to a bin. It takes the index of the bin and the index of the label as arguments.

using ZeroCallback = std::function<void(uint32 labelIndex)>

A callback function that is invoked when a label with zero statistics is encountered. It takes the index of the label as an argument.

Public Functions

inline virtual ~ILabelBinning()
virtual uint32 getMaxBins(uint32 numLabels) const = 0

Returns an upper bound for the number of bins used by the binning method, given a specific number of labels for which rules may predict.

Parameters:

numLabels – The number of labels for which rules may predict

Returns:

The maximum number of bins used by the binning method

virtual LabelInfo<CriteriaType> getLabelInfo(typename View<CriteriaType>::const_iterator criteria, uint32 numCriteria) const = 0

Retrieves and returns information that is required to apply the binning method.

This function must be called prior to the function createBins to obtain information, e.g. the number of bins to be used, that is required to apply the binning method. This function may also be used to prepare, e.g. sort, the given vector. The LabelInfo returned by this function must be passed to the function createBins later on.

Parameters:
  • criteria – An iterator to the label-wise criteria that should be used to assign individual labels to bins

  • numCriteria – The number of label-wise criteria

Returns:

A struct of type LabelInfo that stores the information

virtual void createBins(LabelInfo<CriteriaType> labelInfo, typename View<CriteriaType>::const_iterator criteria, uint32 numCriteria, Callback callback, ZeroCallback zeroCallback) const = 0

Assigns the labels to bins based on label-wise criteria.

Parameters:
  • labelInfo – A struct of type LabelInfo that stores information that is required to apply the binning method

  • criteria – An iterator to the label-wise criteria that should be used to assign individual labels to bins

  • numCriteria – The number of label-wise criteria

  • callback – A callback that is invoked when a label is assigned to a bin

  • zeroCallback – A callback that is invoked when a label for which the criterion is zero is encountered

class ILabelBinningFactory
#include <label_binning.hpp>

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

Public Functions

inline virtual ~ILabelBinningFactory()
virtual std::unique_ptr<ILabelBinning<float32>> create32Bit() const = 0

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

Returns:

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

virtual std::unique_ptr<ILabelBinning<float64>> create64Bit() const = 0

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

Returns:

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

class ILabelBinningConfig
#include <label_binning.hpp>

Defines an interface for all classes that allow to configure a method that assigns labels to bins.

Subclassed by boosting::AutomaticLabelBinningConfig, boosting::EqualWidthLabelBinningConfig, boosting::NoLabelBinningConfig

Public Functions

inline virtual ~ILabelBinningConfig()
virtual std::unique_ptr<IDecomposableRuleEvaluationFactory> createDecomposableCompleteRuleEvaluationFactory() const = 0

Creates and returns a new object of type IDecomposableRuleEvaluationFactory that allows to calculate the predictions of complete rules according to the specified configuration.

Returns:

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

virtual std::unique_ptr<ISparseDecomposableRuleEvaluationFactory> createDecomposableFixedPartialRuleEvaluationFactory(float32 outputRatio, uint32 minOutputs, uint32 maxOutputs) const = 0

Creates and returns a new object of type ISparseDecomposableRuleEvaluationFactory that allows to calculate the prediction of partial rules, which predict for a predefined number of outputs, according to the specified configuration.

Parameters:
  • outputRatio – A percentage that specifies for how many outputs the rule heads should predict

  • minOutputs – The minimum number of outputs for which the rule heads should predict

  • maxOutputs – The maximum number of outputs for which the rule heads should predict

Returns:

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

virtual std::unique_ptr<ISparseDecomposableRuleEvaluationFactory> createDecomposableDynamicPartialRuleEvaluationFactory(float32 threshold, float32 exponent) const = 0

Creates and returns a new object of type ISparseDecomposableRuleEvaluationFactory that allows to calculate the prediction of partial rules, which predict for a subset of the available outputs that is determined dynamically, according to the specified configuration.

Parameters:
  • threshold – A threshold that affects for how many outputs the rule heads should predict

  • exponent – An exponent that is used to weigh the estimated predictive quality for individual outputs

Returns:

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

virtual std::unique_ptr<INonDecomposableRuleEvaluationFactory> createNonDecomposableCompleteRuleEvaluationFactory(const BlasFactory &blasFactory, const LapackFactory &lapackFactory) const = 0

Creates and returns a new object of type INonDecomposableRuleEvaluationFactory that allows to calculate the predictions of complete rules according to the specified configuration.

Parameters:
  • 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

Returns:

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

virtual std::unique_ptr<INonDecomposableRuleEvaluationFactory> createNonDecomposableFixedPartialRuleEvaluationFactory(float32 outputRatio, uint32 minOutputs, uint32 maxOutputs, const BlasFactory &blasFactory, const LapackFactory &lapackFactory) const = 0

Creates and returns a new object of type INonDecomposableRuleEvaluationFactory that allows to calculate the predictions of partial rules, which predict for a predefined number of outputs, according to the specified configuration.

Parameters:
  • outputRatio – A percentage that specifies for how many outputs the rule heads should predict

  • minOutputs – The minimum number of outputs for which the rule heads should predict

  • maxOutputs – The maximum number of outputs for which the rule heads should predict

  • 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

Returns:

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

virtual std::unique_ptr<INonDecomposableRuleEvaluationFactory> createNonDecomposableDynamicPartialRuleEvaluationFactory(float32 threshold, float32 exponent, const BlasFactory &blasFactory, const LapackFactory &lapackFactory) const = 0

Creates and returns a new object of type INonDecomposableRuleEvaluationFactory that allows to calculate the predictions of partial rules, which predict for a subset of the available labels that is determined dynamically, according to the specified configuration.

Parameters:
  • threshold – A threshold that affects for how many labels the rule heads should predict

  • exponent – An exponent that is used to weigh the estimated predictive quality for individual labels

  • 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

Returns:

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