等張迴歸#

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

求解等張迴歸模型。

更多資訊請參考使用者指南

參數:
yarray-like,形狀 (n_samples,)

資料。

sample_weightarray-like,形狀 (n_samples,),預設值=None

迴歸中每個點的權重。如果為 None,則權重設定為 1(相等權重)。

y_minfloat,預設值=None

最低預測值的下限(最小值可能仍較高)。如果未設定,則預設為 -inf。

y_maxfloat,預設值=None

最高預測值的上限(最大值可能仍較低)。如果未設定,則預設為 +inf。

increasingbool,預設值=True

決定是否計算 y_ 是遞增(若設定為 True)或遞減(若設定為 False)。

回傳:
y_形狀為 (n_samples,) 的 ndarray

y 的等張擬合結果。

參考文獻

Michael J. Best 與 Nilotpal Chakravarti 撰寫的 “Active set algorithms for isotonic regression; A unifying framework” 第 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...])