Skip to content
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

switch to {cli} in check_args() functions #1093

Merged
merged 25 commits into from
Apr 10, 2024
Merged

switch to {cli} in check_args() functions #1093

merged 25 commits into from
Apr 10, 2024

Conversation

EmilHvitfeldt
Copy link
Member

@EmilHvitfeldt EmilHvitfeldt commented Apr 1, 2024

Ref: #1081

Now the call are being passed around, such as it is being emitted from fit() which feels appropriate. I wonder is there is a way to signal the model as well? so instead of saying Error in fit(): it says something like Error in fit() for discrim_linear(): or something to that liking. It would be nice for workflowsets

Also, I didn't detect any tests 😬 so I'll add those as well

library(parsnip)
library(discrim)

discrim_linear(penalty = -2) |>
  fit(Species ~ ., data = iris)
#> Error in `fit()`:
#> ! The amount of regularization, `penalty`, should be `>= 0`.

Extension packages:

Empty tests

Some of the tests are left intentionally empty, this is either because there is a placeholder check_args() method with no checking, or no method at all. All missing methods will be handled by #1094

@EmilHvitfeldt
Copy link
Member Author

This PR converts existing checks to {cli}, expanded checking will be tracked with #1095

@EmilHvitfeldt
Copy link
Member Author

Todo: make sure we allow zero length input in input checking as per #1099

DESCRIPTION Show resolved Hide resolved
R/bag_tree.R Show resolved Hide resolved
R/boost_tree.R Outdated Show resolved Hide resolved
R/decision_tree.R Show resolved Hide resolved
R/rand_forest.R Show resolved Hide resolved
tests/testthat/test_mlp.R Show resolved Hide resolved
tests/testthat/test_nullmodel.R Outdated Show resolved Hide resolved
Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so happy you did this! These are a huge improvement.

I'm going to leave a "Comment" review to indicate that I'd like to take another look and re-review after you work through review comments, just because there are so many lines affected and cli markup mistakes can hard to spot visually on the first try. I'm around and interruptable today, so re-review should come quick. :)

R/c5_rules.R Show resolved Hide resolved
R/cubist_rules.R Outdated Show resolved Hide resolved
R/discrim_flexible.R Outdated Show resolved Hide resolved
R/discrim_linear.R Outdated Show resolved Hide resolved
R/linear_reg.R Outdated Show resolved Hide resolved
R/logistic_reg.R Outdated Show resolved Hide resolved
R/mlp.R Show resolved Hide resolved
tests/testthat/_snaps/logistic_reg.md Outdated Show resolved Hide resolved
tests/testthat/test_nearest_neighbor.R Outdated Show resolved Hide resolved
tests/testthat/test_svm_rbf.R Outdated Show resolved Hide resolved
Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STELLAR

R/nearest_neighbor.R Show resolved Hide resolved
tests/testthat/_snaps/logistic_reg.md Outdated Show resolved Hide resolved
R/logistic_reg.R Show resolved Hide resolved
@EmilHvitfeldt EmilHvitfeldt merged commit 2f386d2 into main Apr 10, 2024
7 checks passed
@EmilHvitfeldt EmilHvitfeldt deleted the cli-check_args branch April 10, 2024 23:32
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants