檢查遞增#
- sklearn.isotonic.check_increasing(x, y)[原始碼]#
判斷 y 是否與 x 單調相關。
根據 Spearman 相關性測試,發現 y 相對於 x 遞增或遞減。
- 參數:
- x形狀為 (n_samples,) 的類陣列
訓練資料。
- y形狀為 (n_samples,) 的類陣列
訓練目標。
- 回傳值:
- increasing_bool布林值
關係是遞增還是遞減。
注意
Spearman 相關係數由數據估計而得,且將估計結果的符號作為最終結果。
如果基於費雪轉換的 95% 信賴區間跨越零,則會發出警告。
參考文獻
費雪轉換。維基百科。https://en.wikipedia.org/wiki/Fisher_transformation
範例
>>> from sklearn.isotonic import check_increasing >>> x, y = [1, 2, 3, 4, 5], [2, 4, 6, 8, 10] >>> check_increasing(x, y) np.True_ >>> y = [10, 8, 6, 4, 2] >>> check_increasing(x, y) np.False_