Stable Local Interpretable Model-Agnostic Explanations (LIME, OptiLIME, BayLIME, ALIME)

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.


limestab

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.

Installation

# install.packages("devtools")
devtools::install_local("path/to/limestab")

Building the package yourself

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

Quick example

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"))

License

MIT

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("limestab")

0.1.0 by Vilda Purutcuoglu, 4 hours ago


Browse source code at https://github.com/cran/limestab


Authors: Simay Toparlak [aut] (affiliation: Department of Biomedical Engineering , Middle East Technical University) , Vilda Purutcuoglu [aut, cre] (affiliation: Department of Statistics , Middle East Technical University)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports stats, utils

Suggests xgboost, testthat


See at CRAN