knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(liftscores) library(data.table) 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.