Learn R Programming

iml (version 0.6.0)

plot.Partial: Plot Partial Dependence

Description

plot.Partial() plots the results of a Partial object.

Usage

# S3 method for Partial
plot(x, rug = TRUE)

Arguments

x

A Partial R6 object

rug

[logical] Should a rug be plotted to indicate the feature distribution?

Value

ggplot2 plot object

See Also

Partial

Examples

Run this code
# 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
pdp.obj = Partial$new(mod, feature = "crim")

# Plot the results directly
plot(pdp.obj)
}
# }

Run the code above in your browser using DataLab