Skip to content

Fix spurious warning in select_by_pct_loss() when losses tie for best - #1203

Open
taekop wants to merge 1 commit into
tidymodels:mainfrom
taekop:fix/pct-loss-tied-best
Open

taekop wants to merge 1 commit into
tidymodels:mainfrom
taekop:fix/pct-loss-tied-best

Conversation

@taekop

@taekop taekop commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

When several configurations tie for the best loss, which(summary_res$.loss == 0) returns more than one index and 1:best_index warns ("numerical expression has 2 elements: only the first used"). The selected configuration is the same either way, but the warning leaks to users. Using max() covers every tied-best row explicitly and removes the warning. The new test builds a tie and snapshots that no warning is raised.

closes #1195

@taekop
taekop force-pushed the fix/pct-loss-tied-best branch from 9fd5cf5 to cf863db Compare October 20, 2026 10:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

select_by_pct_loss() silently drops tied best-loss configurations

1 participant