check_increasing#

sklearn.isotonic.check_increasing(x, y)[源代码]#

确定 y 是否与 x 单调相关。

根据斯皮尔曼相关性检验,确定 y 相对于 x 是递增还是递减。

参数:
x形状为 (n_samples,) 的类数组对象

训练数据。

y形状为 (n_samples,) 的类数组对象

训练目标。

返回:
increasing_bool布尔值

关系是递增还是递减。

注意

斯皮尔曼相关系数从数据中估计得出,其估计值的符号用作结果。

如果基于 Fisher 变换的 95% 置信区间包含零,则会发出警告。

参考文献

Fisher 变换。维基百科。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_