Several cutoffs can share the optimum. The one with the smallest rank
is returned - the threshold that calls the fewest instances positive -
so the result is one row per model per test dataset whatever the data
does.
Rows that share a score are an exception, because they are one
threshold seen several times rather than several cutoffs: score >=
that value calls all of the tied instances positive, so the rank
reported is the last of the run and not the first. That is what
evalmod(basic_ties = "hold") produces throughout, since it gives every
cutoff in a run of tied scores the counts of the whole run.
The rank 0 row of metric_table() - the rule that calls nothing
positive - is not a candidate. There is no threshold that predicts
nothing, so its score is NA and it is not an operating point, which
is what this function returns. It would otherwise win outright wherever
the empty rule is optimal, and win on the tie-break wherever it merely
ties: precision at rank 0 is the limit from above, so it is 1
whenever the top-ranked instance is a positive, and any classifier that
ranks one first would come back with no threshold at all.
A metric that has no interior optimum is still optimized at an end of the
range, and no warning says so: sensitivity is largest when everything
is called positive, and specificity when as little as possible is.
Those are the correct answers to the question asked, and rarely the
question meant. accuracy and error have an interior optimum on
balanced data and lose it as positives get rare, which is the same trap
arriving by a different route: at a few percent positives, calling almost
nothing positive is close to the most accurate thing a classifier can do.
A cutoff chosen on the same data the model is evaluated on is optimistic,
by however much the criterion was free to chase. Choosing it on held-out
data is the fix, and it is the caller's to make: nothing here resamples
or cross-validates the choice.