hoi.utils.digitize#
- hoi.utils.digitize(x, n_bins, axis=0, use_sklearn=False, **kwargs)[source]#
Discretize a continuous variable.
- Parameters:
- xarray_like
Array to discretize
- n_binsint
Number of bins
- axisint | 0
Axis along which to perform the discretization. By default, discretization is performed along the first axis (n_samples,)
- use_sklearnbool | False
If True, use sklearn.preprocessing.KBinsDiscretizer to discretize the data.
- kwargsdict | {}
Additional arguments are passed to sklearn.preprocessing.KBinsDiscretizer. For example, use strategy=’quantile’ for equal population binning.
- Returns:
- x_binnedarray_like
Digitized array with the same shape as x
Examples using hoi.utils.digitize
#
Comparison of mutual-information estimators
Comparison of mutual-information estimators