使用 tidymodels 进行数据预处理和重采样

问题描述 投票:0回答:1

我正在关注 Julia Silge 的 YouTube 视频,但无法完成练习。 在这部分代码中出现以下错误:

set.seed(234)
glm_rs <- glm_spec %>%
  fit_resamples(diversity ~ .,
                folds,
                metrics = metric_set(roc_auc,sens,spec),
                control = control_resamples(save_pred = TRUE))


Error: 
The combination of metric functions must be:
- only numeric metrics
- a mix of class metrics and class probability metrics

The following metric function types are being mixed:
- prob (roc_auc)
- class (sens)
- other (spec <namespace:readr>)

知道发生了什么吗?

问候

卢卡斯扎戈

r tidyverse metrics roc auc
1个回答
0
投票

我也遇到这个问题了。我使用了tidymodels::tidymodels_prefer,发现没有效果。最终的解决方案是更新 tidymodels 软件包(install.packages("tidymodels"))。或者你可以尝试尺度::规格。

© www.soinside.com 2019 - 2024. All rights reserved.