topk_evals#
- scio.eval.topk_evals(evals, k=1, *, baseline=None)[source]#
Identify best performing scores in at least one scenario.
- Parameters:
evals (
NDArray[np.floating]) – Input evaluations, usually from acompute_metrics()call. Shape must be(n, *scenarios_shape).k (
int) – Parameter defining the top \(k\) for every scenario. Ifnot 0 < k <= n, every row is selected — even if full ofnan(see Note below). Defaults to1.baseline (
int, optional) – If provided, the corresponding row is considered separately and always included in the final result.
- Returns:
idxs (
NDArray[np.integer]) – Indexes of the rows ofevalswith at least one value in topk, across rows. Additionally, seebaselineif provided. It is a sorted \(1\)D array.
Note
Conventionally,
nanvalues are never considered amongst topk.Tip
Using
k=len(evals)can be useful to filter out only rows full ofnan.