check_increasing#

sklearn.isotonic.check_increasing(x, y)[source]#

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

y is found increasing or decreasing with respect to x based on a Spearman correlation test.

参数:
xarray-like of shape (n_samples,)

训练数据。

yarray-like of shape (n_samples,)

Training target.

返回:
increasing_boolboolean

Whether the relationship is increasing or decreasing.

注意事项

The Spearman correlation coefficient is estimated from the data, and the sign of the resulting estimate is used as the result.

In the event that the 95% confidence interval based on Fisher transform spans zero, a warning is raised.

References

Fisher transformation. Wikipedia. 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_