# NOT RUN {
# }
# NOT RUN {
library("EIX")
library("Matrix")
sm <- sparse.model.matrix(left ~ . - 1, data = HR_data)
library("xgboost")
param <- list(objective = "binary:logistic", max_depth = 2)
xgb_model <- xgboost(sm, params = param, label = HR_data[, left] == 1, nrounds = 25, verbose=0)
data <- HR_data[9,-7]
new_observation <- sm[9,]
wf <- waterfall(xgb_model, new_observation, data, option = "interactions")
wf
plot(wf)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab