Sklearn分箱过程-是否可以返回间隔?

时间:2019-09-27 01:24:30

标签: python-3.x python-2.7 scikit-learn binning discretization

我正在尝试使用KBinsDiscretizer中的sklearn.preprocessing,但它返回的整数值为1,2,.. N(代表间隔)。是否可以将正确的间隔返回为(0.2,0.5)还是尚未实现?

1 个答案:

答案 0 :(得分:0)

基于文档:https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.html

  

属性:n_bins_:整数数组,形状(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.```