plot.LocalModel: Plot Local Model

View source: R/LocalModel.R

plot.LocalModelR Documentation

Plot Local Model

Description

plot.LocalModel() plots the feature effects of a LocalModel object.

Usage

## S3 method for class 'LocalModel'
plot(object)

Arguments

object

A LocalModel R6 object

Value

ggplot2 plot object

See Also

LocalModel

Examples

library("randomForest")
# First we fit a machine learning model on the Boston housing data
data("Boston", package = "MASS")
X <- Boston[-which(names(Boston) == "medv")]
rf <- randomForest(medv ~ ., data = Boston, ntree = 50)
mod <- Predictor$new(rf, data = X)

# Explain the first instance of the dataset with the LocalModel method:
x.interest <- X[1, ]
lemon <- LocalModel$new(mod, x.interest = x.interest, k = 2)
plot(lemon)

iml documentation built on May 29, 2024, 1:59 a.m.