rclassificationdecision-treetidymodels

Create and plot ROC curve with tidymodels


Trying out a classification bagged tree in tidymodels and all is good until I get to creating and plotting the ROC curve. Then I get an

# Error in 'roc_curve()': ! Can't rename variables in this context. 

My csv and the script I've written are here

Predicting on the train set produced no errors

predictions<- predict(model_bagged, bank_train, type= "prob") %>% bind_cols(bank_train)

and there's a .pred_yes column in the output, so I'm not sure where the error is coming from or what it means.


Solution

  • The roc_curve() function doesn't use the estimate argument, and instead needs you to pass in the columns of the estimated values unnamed, to the ..., like so:

    roc_curve(predictions,
              truth = still_customer,
              .pred_yes)
    

    This is the case for all the class probability metrics