Learn R Programming

fastml (version 0.7.7)

plot_ice: Plot ICE curves for a fastml model

Description

Generates Individual Conditional Expectation (ICE) plots for selected features using the `pdp` package (ggplot2 engine), and returns both the underlying data and the plot object.

Usage

plot_ice(object, features, data = c("train", "test"), target_class = NULL, ...)

Value

A list with two elements: `data` (the ICE data frame) and `plot` (the ggplot object).

Arguments

object

A `fastml` object.

features

Character vector of feature names to plot.

data

Character string specifying which data to use: "train" (default) or "test".

target_class

For classification, which class probability to plot. If NULL (default), uses the positive class determined by the model settings. For multiclass problems, this shows the probability of the specified class vs all others.

...

Additional arguments passed to `pdp::partial`.

Examples

Run this code
if (FALSE) {
data(iris)
iris <- iris[iris$Species != "setosa", ]
iris$Species <- factor(iris$Species)
model <- fastml(data = iris, label = "Species")
plot_ice(model, features = "Sepal.Length")
}

Run the code above in your browser using DataLab