警告消息:所有模型在[fit_resamples()]中失败。请参阅“.notes”列

警告消息:所有模型在[fit_resamples()]中失败。请参阅“.notes”列,r,logistic-regression,glm,tidymodels,r-recipes,R,Logistic Regression,Glm,Tidymodels,R Recipes,我在tidymodels包中使用了recipe()函数来插补缺失值和修复不平衡数据 这是我的数据 mer_df <- mer2 %>% filter(!is.na(laststagestatus2)) %>% select(Id, Age_Range__c, Gender__c, numberoflead, leadduration, firsttouch, lasttouch, laststagestatus2)%>% mutate_if(is.chara

我在
tidymodels
包中使用了
recipe()
函数来插补缺失值和修复不平衡数据

这是我的数据

mer_df <- mer2 %>%
  filter(!is.na(laststagestatus2)) %>% 
  select(Id, Age_Range__c, Gender__c, numberoflead, leadduration, firsttouch, lasttouch, laststagestatus2)%>%
  mutate_if(is.character, factor) %>%
  mutate_if(is.logical, as.integer)


# A tibble: 197,836 x 8
   Id    Age_Range__c Gender__c numberoflead leadduration firsttouch lasttouch
   <fct> <fct>        <fct>            <int>        <dbl> <fct>      <fct>    
 1 0010~ NA           NA                   2     5.99     Dealer IB~ Walk in  
 2 0010~ NA           NA                   1     0        Online Se~ Online S~
 3 0010~ NA           NA                   1     0        Walk in    Walk in  
 4 0010~ NA           NA                   1     0        Online Se~ Online S~
 5 0010~ NA           NA                   2     0.0128   Dealer IB~ Dealer I~
 6 0010~ NA           NA                   1     0        OB Call    OB Call  
 7 0010~ NA           NA                   1     0        Dealer IB~ Dealer I~
 8 0010~ NA           NA                   4    73.9      Dealer IB~ Walk in  
 9 0010~ NA           Male                24     0.000208 OB Call    OB Call  
10 0010~ NA           NA                  18     0.000150 OB Call    OB Call  
# ... with 197,826 more rows, and 1 more variable: laststagestatus2 <fct>
我收到的警告是:

Warning message:
All models failed in [fit_resamples()]. See the `.notes` column. 


    Resampling results
10-fold cross-validation using stratification 
 A tibble: 10 x 5
   splits                 id     .metrics .notes           .predictions
   <list>                 <chr>  <list>   <list>           <list>      
 1 <split [133.5K/14.8K]> Fold01 <NULL>   <tibble [1 x 1]> <NULL>      
 2 <split [133.5K/14.8K]> Fold02 <NULL>   <tibble [1 x 1]> <NULL>      
 3 <split [133.5K/14.8K]> Fold03 <NULL>   <tibble [1 x 1]> <NULL>      
 4 <split [133.5K/14.8K]> Fold04 <NULL>   <tibble [1 x 1]> <NULL>      
 5 <split [133.5K/14.8K]> Fold05 <NULL>   <tibble [1 x 1]> <NULL>      
 6 <split [133.5K/14.8K]> Fold06 <NULL>   <tibble [1 x 1]> <NULL>      
 7 <split [133.5K/14.8K]> Fold07 <NULL>   <tibble [1 x 1]> <NULL>      
 8 <split [133.5K/14.8K]> Fold08 <NULL>   <tibble [1 x 1]> <NULL>      
 9 <split [133.5K/14.8K]> Fold09 <NULL>   <tibble [1 x 1]> <NULL>      
10 <split [133.5K/14.8K]> Fold10 <NULL>   <tibble [1 x 1]> <NULL> 

Warning message:
This tuning result has notes. Example notes on model fitting include:
recipe: Error: could not find function "all_nominal"
警告消息:
所有模型在[fit_resamples()]中失败。请参阅“.notes”列。
重采样结果
使用分层的10倍交叉验证
一个tibble:10x5
拆分id.度量.注释.预测
1折叠01
2折叠02
3折叠03
4折叠4
5.折叠
折叠
7折叠07
8折叠08
9折叠09
10折叠10
警告信息:
此调整结果具有注释。有关模型拟合的示例注释包括:
配方:错误:找不到函数“all_nominal”

有人对如何做到这一点有什么建议吗?非常感谢你的帮助

如果你能提供一个完整的可复制的例子,那就更好了。我强烈怀疑你是在Windows机器上工作的。当前有一个bug影响了tidymodels在Windows上的并行处理。到今天为止,配方已经在CRAN上更新,但是您需要在GitHub上更新到tune和parsnip的开发版本,以便在workers中正确加载包。我们正在尽快将这些修复程序安装到CRAN上。
doParallel::registerDoParallel()
    glm_rs <- mer_wf %>%
      add_model(glm_spec) %>%
      fit_resamples(
        resamples = mer_folds,
        metrics = mer_metrics,
        control = control_resamples(save_pred = TRUE)
glm_rs
Warning message:
All models failed in [fit_resamples()]. See the `.notes` column. 


    Resampling results
10-fold cross-validation using stratification 
 A tibble: 10 x 5
   splits                 id     .metrics .notes           .predictions
   <list>                 <chr>  <list>   <list>           <list>      
 1 <split [133.5K/14.8K]> Fold01 <NULL>   <tibble [1 x 1]> <NULL>      
 2 <split [133.5K/14.8K]> Fold02 <NULL>   <tibble [1 x 1]> <NULL>      
 3 <split [133.5K/14.8K]> Fold03 <NULL>   <tibble [1 x 1]> <NULL>      
 4 <split [133.5K/14.8K]> Fold04 <NULL>   <tibble [1 x 1]> <NULL>      
 5 <split [133.5K/14.8K]> Fold05 <NULL>   <tibble [1 x 1]> <NULL>      
 6 <split [133.5K/14.8K]> Fold06 <NULL>   <tibble [1 x 1]> <NULL>      
 7 <split [133.5K/14.8K]> Fold07 <NULL>   <tibble [1 x 1]> <NULL>      
 8 <split [133.5K/14.8K]> Fold08 <NULL>   <tibble [1 x 1]> <NULL>      
 9 <split [133.5K/14.8K]> Fold09 <NULL>   <tibble [1 x 1]> <NULL>      
10 <split [133.5K/14.8K]> Fold10 <NULL>   <tibble [1 x 1]> <NULL> 

Warning message:
This tuning result has notes. Example notes on model fitting include:
recipe: Error: could not find function "all_nominal"