简体   繁体   English

如何为 yardstick 包中的 roc_auc() 函数正确设置估计参数

[英]How to set the estimate argument correctly for roc_auc() function in yardstick package

I want to compute the AUC for a model.我想计算模型的 AUC。

library(yardstick)
data(two_class_example)

This code works.此代码有效。

roc_auc(
  two_class_example,
  truth = truth,
  Class1,
  options = list(smooth = TRUE)
)

I like to specify arguments so that my code is easier to read and debug.我喜欢指定参数,以便我的代码更易于阅读和调试。

roc_auc(
  two_class_example,
  truth = truth,
  estimate=Class1,
  options = list(smooth = TRUE)
)

This gives the following error这给出了以下错误

Error in metric_summarizer(metric_nm = "roc_auc", metric_fn = roc_auc_vec, : formal argument "estimate" matched by multiple actual arguments metric_summarizer(metric_nm = "roc_auc", metric_fn = roc_auc_vec, 中的错误:形式参数“估计”与多个实际参数匹配

Please explain this error.请解释这个错误。 I thought the Class1 column is the vector of estimated class probabilities.我认为 Class1 列是估计类概率的向量。

According to the help page for the function, the Class1 variable falls in the ... argument, not the estimate argument (in fact, no such argument appears to exist).根据该函数的帮助页面,Class1 变量属于...参数,而不是估计参数(实际上,似乎不存在这样的参数)。 About the ... , it reads:关于... ,它写道:

A set of unquoted column names or one or more dplyr selector functions to choose which variables contain the class probabilities.一组不带引号的列名或一个或多个 dplyr 选择器函数来选择哪些变量包含类概率。 If truth is binary, only 1 column should be selected.如果真值是二进制的,则只应选择 1 列。 Otherwise, there should be as many columns as factor levels of truth.否则,应该有与真实因子水平一样多的列。

Basically, there's no argument for you to worry about specifying.基本上,您无需担心指定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM