Provides four local explanation methods for tabular data: LIME, OptiLIME, BayLIME, and ALIME, together with the stability metrics used to compare them across repeated explanations of the same instance: the Coefficient Stability Index (CSI), the Variable Stability Index (VSI), Median Rank Matching Stability (MRMS), Point-Based Stability Index (PCSI), and Interval Coefficient Stability Index (ICSI). The methodology accompanies Toparlak and Purutcuoglu, "A Median-Based Framework for Assessing the Stability in XAI Tools" (manuscript under revision); the citation will be updated upon publication.
An R package providing LIME, OptiLIME, BayLIME and ALIME for tabular data, together with a common set of stability diagnostics (CSI, VSI, MRMS, PCSI, ICSI) for repeated explanations of the same instance.
# install.packages("devtools")
devtools::install_local("path/to/limestab")
This project ships as a documented R source package. To regenerate the documentation and run package checks from the package root, use:
install.packages(c("devtools", "roxygen2", "testthat"))
devtools::document() # regenerates NAMESPACE and man/*.Rd from roxygen comments
devtools::check() # runs R CMD check
devtools::build() # builds the source tarball for CRAN-style submission
library(limestab)
set.seed(1)
x <- matrix(rnorm(300 * 3), 300, 3, dimnames = list(NULL, c("a", "b", "c")))
predict_fn <- function(m) 2 * m[, "a"] - m[, "b"]
ex <- lime_explainer(x, feature_names = c("a", "b", "c"))
expl <- lime_explain_instance(ex, x[1, ], predict_fn, num_features = 3)
expl$local_exp
stab <- lime_check_stability(ex, x[1, ], predict_fn, num_features = 3, n_calls = 10)
stab$csi
stab$vsi
A full LIME vs. OptiLIME vs. BayLIME vs. ALIME comparison on the Pima Indians Diabetes data set is bundled as an example:
source(system.file("examples", "diabetes_four_methods.R", package = "limestab"))
MIT