Skip to content

Convert logical inputs to factors #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tripartio
Copy link

@tripartio tripartio commented Jun 4, 2025

Instead of logical inputs being errors, for class and prob metrics, logical truth is converted to factor(truth). For class metrics, logical estimate is converted to factor(estimate). For both, when event_level is used, it always set to "second" (TRUE) for logical truth inputs. A detailed justification is provided in issue #545.

This PR includes the complete working solution, including a commit with tests. All existing and new tests pass.

tripartio added 2 commits June 4, 2025 20:16
Instead of logical inputs being errors, for class and prob metrics, logical truth is converted to factor(truth). For class metrics, logical estimate is converted to factor(estimate). For both, when event_level is used, it always set to "second" (TRUE) for logical truth inputs.
Logical inputs to selected functions now work instead of erroring (they are internally converted to factors)
tripartio added 3 commits June 5, 2025 09:30
A bug made any estimate vector factors whenever the truth vector was logical. Now, only logical estimates and made factors if truth vectors are factors. So, character estimates now error appropriately.
tidymodels#545 (comment)
Hide folder created by revdepcheck
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.

1 participant