`R/ROC.R`

`find_matching_conditional_betas.Rd`

Based on https://win-vector.com/2020/09/13/why-working-with-auc-is-more-powerful-than-one-might-think/. Used to find one beta distribution on positive examples, and another on negative examples.

find_matching_conditional_betas(modelPredictions, yValues, ..., yTarget = TRUE) find_ROC_matching_ab(modelPredictions, yValues, ..., yTarget = TRUE)

modelPredictions | numeric predictions (not empty), ordered (either increasing or decreasing) |
---|---|

yValues | truth values (not empty, same length as model predictions) |

... | force later arguments to bind by name. |

yTarget | value considered to be positive. |

beta curve shape parameters

d <- rbind( data.frame(x = rbeta(1000, shape1 = 6, shape2 = 4), y = TRUE), data.frame(x = rbeta(1000, shape1 = 2, shape2 = 3), y = FALSE) ) find_matching_conditional_betas(modelPredictions = d$x, yValues = d$y)#> shape1_pos shape2_pos shape1_neg shape2_neg #> 6.364140 4.189832 1.937121 2.969809# should be near # shape1_pos shape2_pos shape1_neg shape2_neg # 6 4 2 3 # # # How to land all as variables # unpack[shape1_pos, shape2_pos, shape1_neg, shape2_neg] <- # find_ROC_matching_ab(modelPredictions = d$x, yValues = d$y)