find_matching_conditional_betas: Find beta shape parameters matching the conditional...

View source: R/ROC.R

find_matching_conditional_betasR Documentation

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)

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.

Value

beta curve shape parameters

Examples


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)


sigr documentation built on Aug. 20, 2023, 9:06 a.m.