The goal of this package is shed light on black box machine learning models.
The main props of
It is simple, yet flexible.
It offers model agnostic tools like model performance, variable importance, global surrogate models, ICE profiles, partial dependence, ALE, and further effects plots, scatter plots, interaction strength, and variable contribution breakdown/SHAP for single observations.
It allows to assess multiple models in parallel.
It supports "group by" operations.
It works with case weights.
Currently, models with numeric or binary response are supported.
Latest version from github:
library(devtools) install_github("mayer79/flashlight", subdir = "release/flashlight")
library(ggplot2) library(MetricsWeighted) library(flashlight) # Fit model fit <- lm(Sepal.Length ~ ., data = iris) # Make flashlight fl <- flashlight( model = fit, data = iris, y = "Sepal.Length", label = "ols", metrics = list(rmse = rmse, `R-squared` = r_squared) )
plot(light_performance(fl), fill = "darkred") + ggtitle("Overall") plot(light_performance(fl, by = "Species"), fill = "darkred") + ggtitle("Grouped by Species")
imp <- light_importance(fl, m_repetitions = 4) plot(imp, fill = "darkred")
plot(light_ice(fl, v = "Petal.Width"))
plot(light_profile(fl, v = "Petal.Width")) + ggtitle("Overall") plot(light_profile(fl, v = "Petal.Width", by = "Species")) + ggtitle("Grouped by Species")
plot(light_profile2d(fl, v = c("Petal.Width", "Petal.Length")))
plot(light_profile(fl, v = "Petal.Width", type = "ale"))
plot(light_profile(fl, v = "Petal.Width", type = "residual", stats = "quartile"))
plot(light_effects(fl, v = "Petal.Width"), use = "all")
plot(light_breakdown(fl, new_obs = iris[2, ]))
Check out the vignette to see the full capabilities of the package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.