简体   繁体   中英

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

I want to compute the AUC for a model.

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

Please explain this error. I thought the Class1 column is the vector of estimated class probabilities.

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). 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. If truth is binary, only 1 column should be selected. Otherwise, there should be as many columns as factor levels of truth.

Basically, there's no argument for you to worry about specifying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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