profit_thresholds {modelimpact} | R Documentation |
Find optimal threshold for churn prediction (class)
Description
Finds the optimal threshold (from a business perspective) for classifying churners.
Usage
profit_thresholds(
x,
var_cost = 0,
prob_accept = 1,
tp_val = 0,
fp_val = 0,
tn_val = 0,
fn_val = 0,
prob_col = NA,
truth_col = NA
)
Arguments
x |
A data frame containing predicted probabilities of a target event and the actual outcome/class. |
var_cost |
Variable cost (e.g. of a campaign offer) |
prob_accept |
Probability of offer being accepted. Defaults to 1. |
tp_val |
The average value of a True Positive. 'var_cost' is automatically subtracted. |
fp_val |
The average cost of a False Positive. 'var_cost' is automatically subtracted. |
tn_val |
The average value of a True Negative. |
fn_val |
The average cost of a False Negative. |
prob_col |
The unquoted name of the column with probabilities of the event of interest. |
truth_col |
The unquoted name of the column with the actual outcome/class. Possible values are 'Yes' and 'No'. #' @return A data frame with the following columns: threshold = prediction thresholds |
Examples
profit_thresholds(predictions,
var_cost = 100,
prob_accept = .8,
tp_val = 2000,
fp_val = 0,
tn_val = 0,
fn_val = -2000,
prob_col = Yes,
truth_col = Churn)