【发布时间】:2020-01-27 07:26:01
【问题描述】:
我正在尝试使用 sklearn.preprocessing 中的 KBinsDiscretizer,但它返回整数值 1,2,..,N(表示间隔)。是否可以将正确的间隔返回为 (0.2, 0.5) 或者这还没有实现?
【问题讨论】:
标签: python-3.x python-2.7 scikit-learn binning discretization
我正在尝试使用 sklearn.preprocessing 中的 KBinsDiscretizer,但它返回整数值 1,2,..,N(表示间隔)。是否可以将正确的间隔返回为 (0.2, 0.5) 或者这还没有实现?
【问题讨论】:
标签: python-3.x python-2.7 scikit-learn binning discretization
基于文档:https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.html:
属性:n_bins_:int数组,形状(n_features,):
Number of bins per feature. Bins whose width are too small (i.e., <= 1e-8) are removed with a warning. bin_edges_ : array of arrays,形状(n_features,):
The edges of each bin. Contain arrays of varying shapes (n_bins_, ) Ignored features will have empty arrays.
在您的情况下,这意味着否。还有一个提示:
The inverse_transform function converts the binned data into the original feature space. Each value will be equal to the mean of the two bin edges.```
【讨论】: