All Projects → thomasp85 → Lime

thomasp85 / Lime

Licence: other
Local Interpretable Model-Agnostic Explanations (R port of original Python package)

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Lime

Deli
Stars: ✭ 148 (-66.21%)
Mutual labels:  modeling, model-checking
Cascadestudio
A Full Live-Scripted CAD Kernel in the Browser
Stars: ✭ 344 (-21.46%)
Mutual labels:  modeling
Fusion360WrapSketch
Wrap sketch curves around a cylinder
Stars: ✭ 33 (-92.47%)
Mutual labels:  modeling
Seahorn
SeaHorn Verification Framework
Stars: ✭ 270 (-38.36%)
Mutual labels:  model-checking
Scorecard-Modeling
Use Machine learning to build scorecard model
Stars: ✭ 26 (-94.06%)
Mutual labels:  modeling
Concuerror
Concuerror is a stateless model checking tool for Erlang programs.
Stars: ✭ 277 (-36.76%)
Mutual labels:  model-checking
Mote3D toolbox
Toolbox for particulate microstructure modelling
Stars: ✭ 36 (-91.78%)
Mutual labels:  modeling
Gempy
GemPy is an open-source, Python-based 3-D structural geological modeling software, which allows the implicit (i.e. automatic) creation of complex geological models from interface and orientation data. It also offers support for stochastic modeling to adress parameter and model uncertainties.
Stars: ✭ 396 (-9.59%)
Mutual labels:  modeling
Blockingqueue
Tutorial "Weeks of debugging can save you hours of TLA+". Each git commit introduces a new concept => check the git history!
Stars: ✭ 343 (-21.69%)
Mutual labels:  model-checking
Cobrapy
COBRApy is a package for constraint-based modeling of metabolic networks.
Stars: ✭ 267 (-39.04%)
Mutual labels:  modeling
Efdesigner
Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
Stars: ✭ 256 (-41.55%)
Mutual labels:  modeling
pymadcad
Simple yet powerful CAD (Computer Aided Design) library, written with Python.
Stars: ✭ 63 (-85.62%)
Mutual labels:  modeling
Sealion
The first machine learning framework that encourages learning ML concepts instead of memorizing class functions.
Stars: ✭ 278 (-36.53%)
Mutual labels:  modeling
Vehicle-Dynamics-Lateral
OpenVD: Vehicle Dynamics - Lateral
Stars: ✭ 50 (-88.58%)
Mutual labels:  modeling
Jetuml
A desktop application for fast UML diagramming.
Stars: ✭ 346 (-21%)
Mutual labels:  modeling
libROM
Model reduction library with an emphasis on large scale parallelism and linear subspace methods
Stars: ✭ 66 (-84.93%)
Mutual labels:  modeling
p5-HackaMol
Object-Oriented Perl 5, Moose Library for Molecular Hacking
Stars: ✭ 12 (-97.26%)
Mutual labels:  modeling
Tool lists
Links to tools by subject
Stars: ✭ 270 (-38.36%)
Mutual labels:  model-checking
Plaitpy
plait.py - a fake data modeler
Stars: ✭ 416 (-5.02%)
Mutual labels:  modeling
Gaphor
Gaphor is the simple modeling tool
Stars: ✭ 386 (-11.87%)
Mutual labels:  modeling

lime

R-CMD-check Codecov test coverage CRAN_Release_Badge CRAN_Download_Badge

There once was a package called lime,

Whose models were simply sublime,

It gave explanations for their variations,

one observation at a time.

lime-rick by Mara Averick


This is an R port of the Python lime package (https://github.com/marcotcr/lime) developed by the authors of the lime (Local Interpretable Model-agnostic Explanations) approach for black-box model explanations. All credits for the invention of the approach goes to the original developers.

The purpose of lime is to explain the predictions of black box classifiers. What this means is that for any given prediction and any given classifier it is able to determine a small set of features in the original data that has driven the outcome of the prediction. To learn more about the methodology of lime read the paper and visit the repository of the original implementation.

The lime package for R does not aim to be a line-by-line port of its Python counterpart. Instead it takes the ideas laid out in the original code and implements them in an API that is idiomatic to R.

An example

Out of the box lime supports a long range of models, e.g. those created with caret, parsnip, and mlr. Support for unsupported models are easy to achieve by adding a predict_model and model_type method for the given model.

The following shows how a random forest model is trained on the iris data set and how lime is then used to explain a set of new observations:

library(caret)
library(lime)

# Split up the data set
iris_test <- iris[1:5, 1:4]
iris_train <- iris[-(1:5), 1:4]
iris_lab <- iris[[5]][-(1:5)]

# Create Random Forest model on iris data
model <- train(iris_train, iris_lab, method = 'rf')

# Create an explainer object
explainer <- lime(iris_train, model)

# Explain new observation
explanation <- explain(iris_test, explainer, n_labels = 1, n_features = 2)

# The output is provided in a consistent tabular format and includes the
# output from the model.
explanation
#> # A tibble: 10 x 13
#>    model_type case  label label_prob model_r2 model_intercept model_prediction
#>    <chr>      <chr> <chr>      <dbl>    <dbl>           <dbl>            <dbl>
#>  1 classific… 1     seto…          1    0.681           0.129            0.987
#>  2 classific… 1     seto…          1    0.681           0.129            0.987
#>  3 classific… 2     seto…          1    0.692           0.123            0.984
#>  4 classific… 2     seto…          1    0.692           0.123            0.984
#>  5 classific… 3     seto…          1    0.686           0.129            0.983
#>  6 classific… 3     seto…          1    0.686           0.129            0.983
#>  7 classific… 4     seto…          1    0.695           0.119            0.985
#>  8 classific… 4     seto…          1    0.695           0.119            0.985
#>  9 classific… 5     seto…          1    0.694           0.123            0.984
#> 10 classific… 5     seto…          1    0.694           0.123            0.984
#> # … with 6 more variables: feature <chr>, feature_value <dbl>,
#> #   feature_weight <dbl>, feature_desc <chr>, data <list>, prediction <list>

# And can be visualised directly
plot_features(explanation)

lime also supports explaining image and text models. For image explanations the relevant areas in an image can be highlighted:

explanation <- .load_image_example()

plot_image_explanation(explanation)

Here we see that the second most probably class is hardly true, but is due to the model picking up waxy areas of the produce and interpreting them as wax-light surface.

For text the explanation can be shown by highlighting the important words. It even includes a shiny application for interactively exploring text models:

interactive text explainer

Installation

lime is available on CRAN and can be installed using the standard approach:

install.packages('lime')

To get the development version, install from GitHub instead:

# install.packages('devtools')
devtools::install_github('thomasp85/lime')

Code of Conduct

Please note that the ‘lime’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].