Evaluate the performance of different (binary) classification models
evalbin( dataset, pred, rvar, lev = "", qnt = 10, cost = 1, margin = 2, train = "All", data_filter = "", envir = parent.frame() )
dataset | Dataset |
---|---|
pred | Predictions or predictors |
rvar | Response variable |
lev | The level in the response variable defined as success |
qnt | Number of bins to create |
cost | Cost for each connection (e.g., email or mailing) |
margin | Margin on each customer purchase |
train | Use data from training ("Training"), test ("Test"), both ("Both"), or all data ("All") to evaluate model evalbin |
data_filter | Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000") |
envir | Environment to extract data from |
A list of results
Evaluate different (binary) classification models based on predictions. See https://radiant-rstats.github.io/docs/model/evalbin.html for an example in Radiant
summary.evalbin
to summarize results
plot.evalbin
to plot results
data.frame(buy = dvd$buy, pred1 = runif(20000), pred2 = ifelse(dvd$buy == "yes", 1, 0)) %>% evalbin(c("pred1", "pred2"), "buy") %>% str()#> List of 10 #> $ dataset : tibble [12 × 13] (S3: tbl_df/tbl/data.frame) #> ..$ pred : Factor w/ 2 levels "pred1","pred2": 1 1 1 1 1 1 1 1 1 1 ... #> ..$ bins : int [1:12] 10 9 8 7 6 5 4 3 2 1 ... #> ..$ nr_obs : int [1:12] 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 ... #> ..$ nr_resp : int [1:12] 529 513 536 523 494 520 555 535 549 492 ... #> ..$ resp_rate : num [1:12] 0.265 0.257 0.268 0.262 0.247 ... #> ..$ gains : num [1:12] 0.1008 0.0978 0.1022 0.0997 0.0942 ... #> ..$ profit : num [1:12] -942 -1916 -2844 -3798 -4810 ... #> ..$ ROME : num [1:12] -0.471 -0.479 -0.474 -0.475 -0.481 ... #> ..$ cum_prop : num [1:12] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 ... #> ..$ cum_resp : int [1:12] 529 1042 1578 2101 2595 3115 3670 4205 4754 5246 ... #> ..$ cum_resp_rate: num [1:12] 0.265 0.261 0.263 0.263 0.26 ... #> ..$ cum_lift : num [1:12] 1.008 0.993 1.003 1.001 0.989 ... #> ..$ cum_gains : num [1:12] 0.101 0.199 0.301 0.4 0.495 ... #> $ df_name : chr "." #> $ data_filter: chr "" #> $ train : chr "All" #> $ pred : chr [1:2] "pred1" "pred2" #> $ rvar : chr "buy" #> $ lev : chr "yes" #> $ qnt : num 10 #> $ cost : num 1 #> $ margin : num 2 #> - attr(*, "class")= chr [1:2] "evalbin" "list"