0
Follow
2
View

R - Tidymodels - Error when using a glm model within a workflow_set

dgj123488 注册会员
2023-01-26 10:37

You are getting this error because what you passed to family was namespaced. Switching family = stats::gaussian("log") with family = gaussian("log") will resolve this error. A bug report have been filed here.

library(tidyverse)
library(tidymodels)

data("mtcars")

glm_recipe = recipe(hp ~ disp, data = mtcars)

glm_model = linear_reg() %>%
  set_engine("glm", family = gaussian("log"))

glm_workflows = workflow_set(list(glm_recipe), list(glm_model))

splits = vfold_cv(mtcars)

workflow_map(glm_workflows, resamples = splits)
#> # A workflow set/tibble: 1 × 4
#>   wflow_id          info             option    result   
#>         
#> 1 recipe_linear_reg   

Created on 2022-06-03 by the reprex package (v2.0.1)