{"id":13791270,"url":"https://github.com/thomasp85/lime","last_synced_at":"2025-04-08T09:11:46.049Z","repository":{"id":56034317,"uuid":"85300689","full_name":"thomasp85/lime","owner":"thomasp85","description":"Local Interpretable Model-Agnostic Explanations (R port of original Python package)","archived":false,"fork":false,"pushed_at":"2022-08-19T09:01:37.000Z","size":11137,"stargazers_count":484,"open_issues_count":51,"forks_count":109,"subscribers_count":30,"default_branch":"main","last_synced_at":"2025-03-31T15:25:45.633Z","etag":null,"topics":["caret","model-checking","model-evaluation","modeling","r"],"latest_commit_sha":null,"homepage":"https://lime.data-imaginist.com/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasp85.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-17T10:40:29.000Z","updated_at":"2025-03-22T11:13:55.000Z","dependencies_parsed_at":"2022-08-15T11:50:44.334Z","dependency_job_id":null,"html_url":"https://github.com/thomasp85/lime","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Flime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Flime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Flime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Flime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasp85","download_url":"https://codeload.github.com/thomasp85/lime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caret","model-checking","model-evaluation","modeling","r"],"created_at":"2024-08-03T22:00:58.170Z","updated_at":"2025-04-08T09:11:46.012Z","avatar_url":"https://github.com/thomasp85.png","language":"R","funding_links":[],"categories":["Keras Cheatsheet","Technical Resources","Uncategorized"],"sub_categories":["Model Explaination","Open Source/Access Responsible AI Software Packages","Uncategorized"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n# lime \u003cimg src=\"man/figures/logo.png\" width=\"131px\" height=\"140px\" align=\"right\" style=\"padding-left:10px;background-color:white;\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/thomasp85/lime/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/lime/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/thomasp85/lime/branch/main/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/lime?branch=main)\n[![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/lime)](https://CRAN.R-project.org/package=lime)\n[![CRAN_Download_Badge](http://cranlogs.r-pkg.org/badges/lime)](https://CRAN.R-project.org/package=lime)\n\u003c!-- badges: end --\u003e\n\n\u003e There once was a package called lime,\n\u003e\n\u003e Whose models were simply sublime,  \n\u003e\n\u003e It gave explanations for their variations, \n\u003e\n\u003e one observation at a time.\n \n*lime-rick by Mara Averick*\n\n* * *\n\n*This is an R port of the Python lime package (https://github.com/marcotcr/lime)\ndeveloped by the authors of the lime (Local Interpretable Model-agnostic \nExplanations) approach for black-box model explanations. All credits for the\ninvention of the approach goes to the original developers.*\n\nThe purpose of `lime` is to explain the predictions of black box classifiers. \nWhat this means is that for any given prediction and any given classifier it is\nable to determine a small set of features in the original data that has driven\nthe outcome of the prediction. To learn more about the methodology of `lime` \nread the [paper](https://arxiv.org/abs/1602.04938) and visit the repository of\nthe [original implementation](https://github.com/marcotcr/lime).\n\nThe `lime` package for R does not aim to be a line-by-line port of its Python\ncounterpart. Instead it takes the ideas laid out in the original code and \nimplements them in an API that is idiomatic to R.\n\n## An example\nOut of the box `lime` supports a long range of models, e.g. those created with\ncaret, parsnip, and mlr. Support for unsupported models are easy to achieve by \nadding a `predict_model` and `model_type` method for the given model.\n\nThe following shows how a random forest model is trained on the iris data set \nand how `lime` is then used to explain a set of new observations:\n\n```{r, message=FALSE, fig.asp=1}\nlibrary(caret)\nlibrary(lime)\n\n# Split up the data set\niris_test \u003c- iris[1:5, 1:4]\niris_train \u003c- iris[-(1:5), 1:4]\niris_lab \u003c- iris[[5]][-(1:5)]\n\n# Create Random Forest model on iris data\nmodel \u003c- train(iris_train, iris_lab, method = 'rf')\n\n# Create an explainer object\nexplainer \u003c- lime(iris_train, model)\n\n# Explain new observation\nexplanation \u003c- explain(iris_test, explainer, n_labels = 1, n_features = 2)\n\n# The output is provided in a consistent tabular format and includes the\n# output from the model.\nexplanation\n\n# And can be visualised directly\nplot_features(explanation)\n```\n\n`lime` also supports explaining image and text models. For image explanations \nthe relevant areas in an image can be highlighted:\n\n```{r, fig.asp=0.5}\nexplanation \u003c- .load_image_example()\n\nplot_image_explanation(explanation)\n```\n\nHere we see that the second most probably class is hardly true, but is due to\nthe model picking up waxy areas of the produce and interpreting them as \nwax-light surface.\n\nFor text the explanation can be shown by highlighting the important words. It \neven includes a `shiny` application for interactively exploring text models:\n\n![interactive text explainer](man/figures/shine_text_explanations.gif)\n\n## Installation\n`lime` is available on CRAN and can be installed using the standard approach:\n\n```{r, eval=FALSE}\ninstall.packages('lime')\n```\n\nTo get the development version, install from GitHub instead:\n\n```{r, eval=FALSE}\n# install.packages('devtools')\ndevtools::install_github('thomasp85/lime')\n```\n\n## Code of Conduct\nPlease note that the 'lime' project is released with a\n[Contributor Code of Conduct](https://lime.data-imaginist.com/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Flime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasp85%2Flime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Flime/lists"}