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

Divert linear regressions with poisson family to poisson_reg() #1219

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

Conversation

topepo
Copy link
Member

@topepo topepo commented Nov 13, 2024

Motivated by tidymodels/tune#956

There are so many ways people can pass the family to glm() and glmnet(). This checks for all four methods that I'm aware of.

@topepo topepo marked this pull request as ready for review November 13, 2024 22:05
@topepo topepo requested a review from hfrick November 13, 2024 22:05
Copy link
Member

@hfrick hfrick left a comment

Choose a reason for hiding this comment

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

Nice one! For your consideration but not a request: Would it make sense to move those checks to check_args.linear_reg() or would checks on engine args in addition to main args mess with anything else?

Comment on lines +364 to +387
expect_snapshot(
linear_reg(penalty = 1) %>%
set_engine("glmnet", family = poisson) %>%
translate(),
error = TRUE
)
expect_snapshot(
linear_reg(penalty = 1) %>%
set_engine("glmnet", family = stats::poisson) %>%
translate(),
error = TRUE
)
expect_snapshot(
linear_reg(penalty = 1) %>%
set_engine("glmnet", family = stats::poisson()) %>%
translate(),
error = TRUE
)
expect_snapshot(
linear_reg(penalty = 1) %>%
set_engine("glmnet", family = "poisson") %>%
translate(),
error = TRUE
)
Copy link
Member

Choose a reason for hiding this comment

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

Love the clarity of these tests

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.

2 participants