Description Usage Arguments Value Examples
View source: R/calculate_lift.R
Provides an overview of the binary classification (Yes, No style) model performance and plots the lift plot
1 2 3 4 5 6 | calculate_lift(
dataWithProbabilityPrediction = pred,
levelPositive = "yes",
responseVariable = "y",
probabilityOfChurning = "pred"
)
|
dataWithProbabilityPrediction |
A data set object with predictions (probabilities) |
levelPositive |
Character, positive categorical true value of the binary outcome variable (e.g., 'Y', 'yes' or 'churned') |
responseVariable |
Character column indicating the response variable (e.g., 'churn') |
probabilityOfChurning |
Character column indicating the column, where the prediction probabilities are saves (e.g., 'predictions') |
A data frame with the Lift values as compared to the base line performance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(data.table)
library(caret)
library(ranger)
data <- fread("https://raw.githubusercontent.com/just4jin/bank-marketing-prediction/master/data/bank_full.csv")
inx <- createDataPartition(data$y, list = FALSE, p = 0.7)
train <- data[inx, ]
test <- data[-inx, ]
set.seed(23)
model_ranger <- ranger(as.factor(y) ~ ., data = train, probability = TRUE)
pred <- data.table(
event = test$y,
pred = predictions(predict(model_ranger, test))[, "yes"]
)
calculate_lift(
dataWithProbabilityPrediction = pred,
levelPositive = "yes",
responseVariable = "event",
probabilityOfChurning = "pred"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.