## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 6,
  fig.height = 4
)

## -----------------------------------------------------------------------------
library(sappviz)
data(iris)
X <- iris[, 1:4]

## -----------------------------------------------------------------------------
model <- lm(Petal.Width ~ Sepal.Length + Sepal.Width + Petal.Length, data = iris)
imp <- abs(coef(model)[-1])
names(imp) <- c("Sepal.Length", "Sepal.Width", "Petal.Length")

## -----------------------------------------------------------------------------
inf <- influence_feature(X, model)
plot_sapp(X, imp, inf, alpha = "auto")

## ----eval=FALSE---------------------------------------------------------------
# library(randomForest)
# rf <- randomForest(Species ~ ., data = iris, importance = TRUE)
# imp_rf <- importance(rf)[, "MeanDecreaseGini"]
# names(imp_rf) <- colnames(X)
# inf_rf <- influence_feature(X, rf)
# plot_sapp(X, imp_rf, inf_rf, alpha = "auto")

