When I make machine learning model of classification such as decision tree, randomforest like that,
I face the error
当我建立像决策树、随机森林这样的机器学习分类模型时,我会遇到错误
# ROC curve
final_pred %>%
roc_curve(truth = Personal_Loan,
estimate = .pred_Yes) %>%
autoplot()
Error in roc_curve()
:
! Can't rename variables in this context.
Run rlang::last_trace()
to see where the error occurred.
# lift curve
final_pred %>%
lift_curve(truth = Personal_Loan,
estimate = .pred_Yes) %>%
autoplot()
Error in lift_curve()
:
! Can't rename variables in this context.
Run rlang::last_trace()
to see where the error occurred.
# gain curve
final_pred %>%
gain_curve(truth = Personal_Loan,
estimate = .pred_Yes) %>%
autoplot()
Error in gain_curve()
:
! Can't rename variables in this context.
Run rlang::last_trace()
to see where the error occurred.
update packages ( yardstick package)
更新程序包(标准程序包)
更多回答
Did you follow the suggestion from the error message and run rlang::last_trace()
? Could you add the output of this comment to your question?
您是否按照错误消息中的建议运行了rlang::last_trace()?你能把这个评论的结果加到你的问题上吗?
The error probably comes from you naming the argument .pred_Yes
. This argument does not exist in the yardstick::roc_curve
function. It expects unquoted column names. So provided the column .pred_Yes
exists in final_pred
, try to run roc_curve(truth = Personal_Loan, .pred_Yes)
.
错误可能来自您将参数命名为.pred_Yes。Yardtick::Roc_Curve函数中不存在此参数。它需要无引号的列名。因此,如果FINAL_PRED中存在.pred_Yes列,请尝试运行ROC_CURE(TRUE=Personal_Loan,.pred_Yes)。
优秀答案推荐
我是一名优秀的程序员,十分优秀!