Plot the response for newdata of a TreeSurrogate object. Each plot facet is one leaf node and visualizes the distribution of the y^ from the machine learning model.
## S3 method for class 'TreeSurrogate'plot(object)
Arguments
object: A TreeSurrogate object.
Returns
ggplot2 plot object
Examples
library("randomForest")# Fit a Random Forest on the Boston housing data setdata("Boston", package ="MASS")rf <- randomForest(medv ~ ., data = Boston, ntree =50)# Create a model objectmod <- Predictor$new(rf, data = Boston[-which(names(Boston)=="medv")])# Fit a decision tree as a surrogate for the whole random forestdt <- TreeSurrogate$new(mod)# Plot the resulting leaf nodesplot(dt)