Compute SHAP Values for Your Tree-Based Models Using the 'TreeSHAP' Algorithm
Overview
An efficient implementation of the 'TreeSHAP' algorithm introduced by Lundberg et al., (2020) doi:10.1038/s42256-019-0138-9. It is capable of calculating SHAP (SHapley Additive exPlanations) values for tree-based models in polynomial time. Currently supported models include 'gbm', 'randomForest', 'ranger', 'xgboost', 'lightgbm'.
- Cleanup in #52 (https://github.com/ModelOriented/treeshap/pull/52). Thanks @kapsner
- Fixed xgboost api and add depends R>=4.1.0 as in #51 (https://github.com/ModelOriented/treeshap/pull/51). Thanks @kapsner
- Fix ranger.unify for probability forests as in #43 (https://github.com/ModelOriented/treeshap/pull/43). Thanks @ck37
- Added support for GPBoost as in #41 (https://github.com/ModelOriented/treeshap/pull/41). Thanks @fabsig
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK6 OK2026-04-25
Documentation
- Help pages
- 28
- Examples that run
- 27%4 run in a plain check (4 of them under a condition) · 11 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 78%
- Documented parameters
- 99%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 632
- Median days to close, 50 most recently updated closed PRs
- 2
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
11 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/modeloriented/treeshap on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-05-02 · The repository has a site deploy workflow
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-05-13Pull request: opened by its own account
Dependencies
Installing treeshap adds 19 packages (9 with compiled code, 21 MB of source tarballs). Heaviest: ggplot2 6.0 MB, data.table 5.7 MB, Rcpp 1.8 MB.
Code & Tests
Datasets
People & History
Previously maintained by Mateusz Krzyzinski (0.2.5 to 0.3.1).
Pick two releases to compare their code metrics.
- unarchivedReturned to CRAN2026-04-24
- 0.4.0Latest
- RR 4.6.0 released · 2026-04-24
- archivedRemoved from CRAN2025-12-17issues were not corrected in time
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- unarchivedReturned to CRAN2024-01-22
- 0.3.12024-01-22 · diff ↗
- archivedRemoved from CRAN2024-01-11issues were not corrected in time
- 0.3.02023-10-24 · diff ↗
- 0.2.52023-10-01
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2023-10-01
- Total releases
- 4 / 3 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 623 KB / 1 file
- Download size
- 808 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("treeshap")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.