{"id":13625248,"url":"https://github.com/marcotcr/anchor","last_synced_at":"2025-05-15T22:03:09.086Z","repository":{"id":29027832,"uuid":"120042974","full_name":"marcotcr/anchor","owner":"marcotcr","description":"Code for \"High-Precision Model-Agnostic Explanations\" paper","archived":false,"fork":false,"pushed_at":"2022-07-19T18:09:12.000Z","size":17194,"stargazers_count":783,"open_issues_count":25,"forks_count":115,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-04-29T09:34:58.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcotcr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-02T23:38:50.000Z","updated_at":"2024-04-18T09:52:45.000Z","dependencies_parsed_at":"2022-07-26T04:02:30.964Z","dependency_job_id":null,"html_url":"https://github.com/marcotcr/anchor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Fanchor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Fanchor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Fanchor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Fanchor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcotcr","download_url":"https://codeload.github.com/marcotcr/anchor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801175,"owners_count":20998339,"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":[],"created_at":"2024-08-01T21:01:53.072Z","updated_at":"2025-04-08T08:16:14.868Z","avatar_url":"https://github.com/marcotcr.png","language":"Jupyter Notebook","funding_links":[],"categories":["Model Explanation","Python Libraries(sort in alphabeta order)","Explaining Black Box Models and Datasets","Explainability and Fairness","Libraries and repositories","模型的可解释性","Jupyter Notebook","Technical Resources"],"sub_categories":["Others","Evaluation methods","Post-hoc explanations","NLP","Open Source/Access Responsible AI Software Packages"],"readme":"# Anchor\nThis repository has code for the paper [*High-Precision Model-Agnostic Explanations*](https://homes.cs.washington.edu/~marcotcr/aaai18.pdf).  \n\nAn anchor explanation is a rule that sufficiently “anchors” the\nprediction locally – such that changes to the rest of the feature\nvalues of the instance do not matter. In other words, for instances on which the anchor holds, the prediction is (almost)\nalways the same.\n\nAt the moment, we support explaining individual predictions for text classifiers or classifiers that act on tables (numpy arrays of numerical or categorical data). If there is enough interest, I can include code and examples for images.\n\nThe anchor method is able to explain any black box classifier, with two or more classes. All we require is that the classifier implements a function that takes in raw text or a numpy array and outputs a prediction (integer)\n\n## Installation\nThe Anchor package is on pypi. Simply run:\n\n    pip install anchor-exp\nOr clone the repository and run:\n\n    python setup.py install\n\nIf you want to use `AnchorTextExplainer`, you have to run the following:\n\n    python -m spacy download en_core_web_lg\n\nAnd if you want to use BERT to perturb inputs (recommended), also install transformers:\n\n    pip install torch transformers spacy \u0026\u0026 python -m spacy download en_core_web_sm\n\n\n#### Examples\nSee notebooks folder for tutorials. Note that from version 0.0.1.0, it only works on python 3.\n\n- [Tabular data](https://github.com/marcotcr/anchor/blob/master/notebooks/Anchor%20on%20tabular%20data.ipynb)\n- [Text data](https://github.com/marcotcr/anchor/blob/master/notebooks/Anchor%20for%20text.ipynb)\n\n## Citation\n[Here](https://homes.cs.washington.edu/~marcotcr/aaai18.bib) is the bibtex if you want to cite this work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcotcr%2Fanchor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcotcr%2Fanchor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcotcr%2Fanchor/lists"}