isotonic_regression#

sklearn.isotonic.isotonic_regression(y, *, sample_weight=None, y_min=None, y_max=None, increasing=True)[源代码]#

求解等张回归模型。

阅读更多的 User Guide .

参数:
y形状类似阵列(n_samples,)

数据。

sample_weight形状类似数组(n_samples,),默认=无

回归每个点的权重。如果无,则权重设置为1(相等权重)。

y_minfloat,默认=无

最低预测值的下限(最小值可能仍然更高)。如果未设置,默认为-inf。

y_maxfloat,默认=无

最高预测值的上限(最大值可能仍然更低)。如果未设置,默认为+inf。

increasing布尔,默认=True

是否计算 y_ 正在增加(如果设置为True)或减少(如果设置为False)。

返回:
y_形状的nd数组(n_samples,)

y的等张配合。

引用

“等张回归的活动集算法;统一框架”作者:Michael J. Best和Nilotpal Chakravarti,第3节。

示例

>>> from sklearn.isotonic import isotonic_regression
>>> isotonic_regression([5, 3, 1, 2, 8, 10, 7, 9, 6, 4])
array([2.75   , 2.75   , 2.75   , 2.75   , 7.33...,
       7.33..., 7.33..., 7.33..., 7.33..., 7.33...])