isotonic_regression#
- sklearn.isotonic.isotonic_regression(y, *, sample_weight=None, y_min=None, y_max=None, increasing=True)[source]#
求解等渗回归模型。
在用户指南中了解更多信息。
- 参数:
- yarray-like of shape (n_samples,)
数据。
- sample_weightshape 为 (n_samples,) 的 array-like, default=None
回归中每个点的权重。如果为 None,则权重设置为 1(等权重)。
- y_minfloat, default=None
最低预测值的下限(最小值仍可能更高)。如果未设置,则默认为 -inf。
- y_maxfloat, default=None
最高预测值的上限(最大值仍可能更低)。如果未设置,则默认为 +inf。
- increasingbool, default=True
计算
y_是递增(如果设置为 True)还是递减(如果设置为 False)。
- 返回:
- y_ndarray of shape (n_samples,)
y 的保序拟合。
References
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])