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

Report event level for logistic_reg() #1112

Open
hfrick opened this issue Apr 11, 2024 · 0 comments
Open

Report event level for logistic_reg() #1112

hfrick opened this issue Apr 11, 2024 · 0 comments
Labels
feature a feature request or enhancement

Comments

@hfrick
Copy link
Member

hfrick commented Apr 11, 2024

It's not always immediately clear which factor level is treated as the event level for logistic regression: it can vary from engine to engine or even for a single engine, depending on the input (e.g. glm() and #491). Usually, we get questions about this once it's time to calculate metrics. Hence the questions surfacing on the yardstick repo more than here and us putting info about theevent_level argument up there.

An additional way to make this a little easier to understand could be to try to store the event level in the parsnip model and, e.g., print it. That only helps when people interact with the model directly but it could be something.

Idea by @mine-cetinkaya-rundel

library(parsnip)
data(two_class_dat, package = "modeldata")

logistic_reg() %>%
  set_engine("glm") %>%
  fit(Class ~ ., data = two_class_dat)
#> parsnip model object
#> 
#> 
#> Call:  stats::glm(formula = Class ~ ., family = stats::binomial, data = data)
#> 
#> Coefficients:
#> (Intercept)            A            B  
#>      -3.749       -1.233        3.829  
#> 
#> Degrees of Freedom: 790 Total (i.e. Null);  788 Residual
#> Null Deviance:       1088 
#> Residual Deviance: 673.9     AIC: 679.9

Created on 2024-04-11 with reprex v2.1.0

@EmilHvitfeldt EmilHvitfeldt added the feature a feature request or enhancement label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants