mlnext.score.get_threshold#

mlnext.score.get_threshold(x: ndarray, *, p: float = 100) float[source]#

Returns the perc-th percentile of x.

Parameters:
  • x (np.ndarray) – Input

  • p (float) – Percentage (0-100).

Returns:

Returns the threshold at the perc-th percentile of x.

Return type:

float

Example

>>> get_threshold(np.ndarray([0.0, 1.0]), p=99)
0.99