You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calibrating by group errors when the group is a factor, since no data is passed to the calibration model. The problem appears to be with how split_dplyr_groups() works.
Reproducible example
library(probably)
#> #> Attaching package: 'probably'#> The following objects are masked from 'package:base':#> #> as.factor, as.ordered
library(tidymodels)
library(tidyverse)
df<- tibble(
p= runif(100),
y=factor(runif(100) <= log(p/ (1-p)), levels= c(TRUE, FALSE)),
z=factor(sample(letters[1:3], 100, replace=TRUE))
)
m<- logistic_reg() %>%
set_engine("glm") %>%
set_mode("classification") %>%
fit(y~p, data=df)
# This worksm_calib<-m %>%
predict(new_data=df, type="prob") %>%
bind_cols(df) %>%
mutate(z= as.character(z)) %>%
cal_estimate_logistic(truth=y, .by=z)
# This errorsm_calib<-m %>%
predict(new_data=df, type="prob") %>%
bind_cols(df) %>%
cal_estimate_logistic(truth=y, .by=z)
#> Error in mgcv::gam(f_model, data = .data, family = "binomial", ...): Not enough (non-NA) data to do anything meaningful
The problem
Calibrating by group errors when the group is a factor, since no data is passed to the calibration model. The problem appears to be with how
split_dplyr_groups()
works.Reproducible example
Created on 2024-03-06 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: