interpret-shap-methods: SHAP result methods.

interpret-shap-methodsR Documentation

SHAP result methods.

Description

These methods provide the standard print(), summary(), and plot() interfaces for funcml_shap objects returned by interpret(method = "shap").

Usage

## S3 method for class 'funcml_shap'
plot(
  x,
  kind = c("auto", "waterfall", "force", "summary", "beeswarm", "importance", "bar",
    "dependence", "dependence2d", "interaction"),
  ...
)

## S3 method for class 'funcml_shap'
print(x, ...)

## S3 method for class 'funcml_shap'
summary(object, ...)

Arguments

x

A funcml_shap object.

kind

Plot kind. One of "auto", "waterfall", "force", "summary", "beeswarm", "importance", "bar", "dependence", "dependence2d", or "interaction".

...

Additional arguments passed to the underlying method. For kind = "summary"/"beeswarm", v restricts the plot to a single feature (default: all interpreted features).

object

A funcml_shap object.

Value

plot() returns a ggplot2 object. print() returns the input object invisibly. summary() returns the SHAP contribution table invisibly.

Examples

fit_obj <- fit(mpg ~ wt + hp + disp, data = mtcars, model = "rpart",
  spec = list(cp = 0.01, minsplit = 5))
shap <- interpret(
  fit = fit_obj,
  data = mtcars,
  method = "shap",
  newdata = mtcars[1, , drop = FALSE],
  nsim = 1
)
print(shap)
summary(shap)
plot(shap)

funcml documentation built on Aug. 22, 2026, 5:08 p.m.