# NOT RUN {
# We train a random forest on the Boston dataset:
if (require("randomForest")) {
data("Boston", package = "MASS")
rf = randomForest(medv ~ ., data = Boston, ntree = 50)
mod = Predictor$new(rf, data = Boston)
# Compute the partial dependence for the first feature
eff = FeatureEffects$new(mod)
# Plot the results directly
eff$plot()
# For a subset of features
eff$plot(features = c("lstat", "crim"))
# With a different layout
eff$plot(nrows = 2)
}
# }
Run the code above in your browser using DataLab