Sklearn Binning Process - 可以 return 一个间隔吗?

Sklearn Binning Process - It is possible to return a interval?

我正在尝试使用 sklearn.preprocessing 中的 KBinsDiscretizer,但它 return 的整数值为 1,2,..,N(表示间隔)。是否有可能 return 一个正确的间隔 (0.2, 0.5) 或者这还没有实现?

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

Attributes: n_bins_ : int array, shape (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,

shape (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.```