mlrl.common.cython.feature_binning module¶
@author: Michael Rapp (michael.rapp.ml@gmail.com)
- class mlrl.common.cython.feature_binning.EqualFrequencyFeatureBinningConfig¶
Bases:
object
Allows to configure a method that assigns numerical feature values to bins, such that each bins contains approximately the same number of values.
- 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) EqualFrequencyFeatureBinningConfig ¶
Sets the percentage that specifies how many bins should be used.
- Parameters:
binRatio – The percentage that specifies how many bins should be used, e.g., if 100 values 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 EqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins
- set_max_bins(max_bins: int) EqualFrequencyFeatureBinningConfig ¶
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 EqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins
- set_min_bins(min_bins: int) EqualFrequencyFeatureBinningConfig ¶
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 2
- Returns:
An EqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins
- class mlrl.common.cython.feature_binning.EqualWidthFeatureBinningConfig¶
Bases:
object
Allow to configure a method that assigns numerical feature values to bins, such that each bin contains values from equally sized value ranges.
- 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) EqualWidthFeatureBinningConfig ¶
Sets the percentage that specifies how many bins should be used.
- Parameters:
bin_ratio – The percentage that specifies how many bins should be used, e.g., if 100 values 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 EqualWidthFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins
- set_max_bins(max_bins: int) EqualWidthFeatureBinningConfig ¶
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 EqualWidthFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins
- set_min_bins(min_bins: int) EqualWidthFeatureBinningConfig ¶
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 2
- Returns:
An EqualWidthFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins