isotonic_regression#

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

求解等渗回归模型。

请参阅用户指南了解更多信息。

参数:
y形状为 (n_samples,) 的类数组

数据。

sample_weight形状为 (n_samples,) 的类数组,默认为 None

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

y_min浮点型,默认为 None

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

y_max浮点型,默认为 None

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

increasing布尔型,默认为 True

计算 y_ 是递增(如果设置为 True)还是递减(如果设置为 False)。

返回:
y_形状为 (n_samples,) 的 ndarray

y 的等渗拟合。

参考文献

“Active set algorithms for isotonic regression; A unifying framework” by Michael J. Best and Nilotpal Chakravarti, section 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])