Learn R Programming

sigr (version 1.1.5)

find_matching_conditional_betas: Find beta shape parameters matching the conditional distributions.

Description

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.

Usage

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

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

Value

beta curve shape parameters

Arguments

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.

Examples

Run this code

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)
# 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)

Run the code above in your browser using DataLab