mlrl.boosting.cython.label_binning module

@author: Michael Rapp (michael.rapp.ml@gmail.com)

class mlrl.boosting.cython.label_binning.EqualWidthLabelBinningConfig

Bases: object

Allows to configure a method that assigns labels to bins in a way such that each bin contains labels for which the predicted score is expected to belong to the same value range.

get_bin_ratio() float

Returns the percentage that specifies how many bins are used.

Returns:

The percentage that specifies how many bins are used

get_max_bins() int

Returns the maximum number of bins that is used.

Returns:

The maximum number of bins that is used

get_min_bins() int

Returns the minimum number of bins that is used.

Returns:

The minimum number of bins that is used

set_bin_ratio(bin_ratio: float) EqualWidthLabelBinningConfig

Sets the percentage that specifies how many should be used.

Parameters:

bin_ratio – A percentage that specifies how many bins should be used, e.g., if 100 labels are available, a percentage of 0.5 means that ceil(0.5 * 100) = 50 bins should be used. Must be in (0, 1)

Returns:

An EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

set_max_bins(max_bins: int) EqualWidthLabelBinningConfig

Sets the maximum number of bins that should be used.

Parameters:

max_bins – The maximum number of bins that should be used. Must be at least the minimum number of bins or 0, if the maximum number of bins should not be restricted

Returns:

An EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

set_min_bins(min_bins: int) EqualWidthLabelBinningConfig

Sets the minimum number of bins that should be used.

Parameters:

min_bins – The minimum number of bins that should be used. Must be at least 1

Returns:

An EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins