mapie.metrics
.length_scale¶
- mapie.metrics.length_scale(s: ndarray[Any, dtype[_ScalarType_co]]) float [source]¶
Compute the mean square root of the sum of s * (1 - s). This is basically the standard deviation of the cumulative differences.
- Parameters
- sNDArray of shape (n_samples,)
An array of scores.
- Returns
- float
The length_scale array.
References
Arrieta-Ibarra I, Gujral P, Tannen J, Tygert M, Xu C. Metrics of calibration for probabilistic predictions. The Journal of Machine Learning Research. 2022 Jan 1;23(1):15886-940.
Examples
>>> import numpy as np >>> from mapie.metrics import length_scale >>> s = np.array([0, 0, 0.4, 0.3, 0.8]) >>> res = length_scale(s) >>> print(np.round(res, 2)) 0.16