| broken.ranger {breakDown} | R Documentation |
Create the broken object for ranger models
## S3 method for class 'ranger' broken(model, new_observation, ..., baseline = 0)
model |
a ranger model |
new_observation |
a new observation with collumns that corresponds to variables used in the model |
... |
other parameters |
baseline |
the orgin/baseline for the breakDown plots, where the rectangles start. It may be a number or a character "Intercept". In the latter case the orgin will be set to model intercept. |
an object of the broken class
## Not run:
library("ranger")
library("ggplot2")
model <- ranger(factor(left) ~ ., data = HR_data, importance = 'impurity')
importance(model)
new_observation <- HR_data[10099,]
explain_1 <- broken(model, new_observation)
explain_1
plot(explain_1) +
ggtitle("breakDown plot for linear predictors of leaving the company") +
scale_y_continuous( limits = c(0,1), name = "fraction of trees", expand = c(0.1,0.1))
## End(Not run)