Calculates and visualises lift as a performance measure for binary classification problems
The following example illustrates the working of the lift function:
library(ranger); library(caret)
data <- fread("https://raw.githubusercontent.com/just4jin/bank-marketing-prediction/master/data/bank_full.csv")
inx <- createDataPartition(data$y, list = F, p = 0.7)
train <- data[inx,]
test <- data[-inx,]
set.seed(23)
model_ranger <- ranger(as.factor(y) ~ ., data = train, probability = T)
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.