Changelog
### 0.44.0
```
This release contains a number enhancements and bug fixes.
What's Changed
Added
* Faster and more stable linear solver in KernelShap by lorentzenchr in https://github.com/shap/shap/pull/3271
* Enabled passing of `ax` to `group_difference()` plot by mtlulka in https://github.com/shap/shap/pull/3355
* Added support for Explanation.display_data in bar plot by fountaindive in https://github.com/shap/shap/pull/3386
* Improved build messages when building from source by connortann in https://github.com/shap/shap/pull/3403
Fixed
* Fixed `CatboostClassifier` explanations with feature interactions on Windows by CloseChoice in https://github.com/shap/shap/pull/3325
* Fixed passing of Xgboost model parameters to xgboost.DMatrix by vancromy in https://github.com/shap/shap/pull/3314
* Explicit specification of xgboost>=1.4 constraint by mtlulka in https://github.com/shap/shap/pull/3352
* Fixed conversion of DMatrix to CSR matrix by thatlittleboy in https://github.com/shap/shap/pull/3359
* Removed deprecated `use_line_collection` in `dependence_plot` by CloseChoice in https://github.com/shap/shap/pull/3369
* Fixed bug relating to array reshaping in `scatter` plots by SomeUserName1 in https://github.com/shap/shap/pull/2799
Documentation
* A large number of [example notebooks](https://shap.readthedocs.io/en/latest) fixed and updated by connortann, znacer , thatlittleboy, CloseChoice and stompsjo
New Contributors
* vancromy made their first contribution in https://github.com/shap/shap/pull/3314
* lorentzenchr made their first contribution in https://github.com/shap/shap/pull/3271
* mtlulka made their first contribution in https://github.com/shap/shap/pull/3352
* fountaindive made their first contribution in https://github.com/shap/shap/pull/3386
* SomeUserName1 made their first contribution in https://github.com/shap/shap/pull/2799
* stompsjo made their first contribution in https://github.com/shap/shap/pull/3391
**Full Changelog**: https://github.com/shap/shap/compare/v0.43.0...V0.44.0
```
### 0.43.0
```
What's Changed
This release contains a number of bug fixes and improvements.
Following the [NEP 29 deprecation policy](https://numpy.org/neps/nep-0029-deprecation_policy.html), this release drops support for python 3.7.
Breaking changes
* Removed the deprecated Boston dataset by thatlittleboy in https://github.com/shap/shap/pull/3316
* The shape of `Explanation.base_values` has been standardised between different TreeExplainer models to always be of shape `(N,)` and not `(N,1)`. By thatlittleboy in https://github.com/shap/shap/pull/3121
Added
* Added additivity check to Pytorch DeepExplainer (activated by default) by noxthot in https://github.com/shap/shap/pull/3265
* Added flag to allow the printing of the mean SHAP value in the legend of a multi-output bar plot. By 101AlexMartin in https://github.com/shap/shap/pull/3062
* Added heatmap and violin plot to top-level API by connortann in https://github.com/shap/shap/pull/3157
* Replaced all tqdm imports with tqdm.auto by owenlamont in https://github.com/shap/shap/pull/3199
Fixed
* Fixed segmentation faults on MacOS with lightgbm tests (with newer libomp versions) by thatlittleboy in https://github.com/shap/shap/pull/3093
* Support LightGBM ensemble containing single leaf trees (stump) by thatlittleboy in https://github.com/shap/shap/pull/3094
* Fixed conversion DataFrame to ndarray for Explanation.data by danieleongari in https://github.com/shap/shap/pull/3131
* Fixed waterfall plot on explanations of sklearn tree models by connortann in https://github.com/shap/shap/pull/3138
* Fixed pandas input for gradient explainer by Koen-Git in https://github.com/shap/shap/pull/3153
* Fixed slicing of `feature_names` in Explanation objects with square `.values` by thatlittleboy in https://github.com/shap/shap/pull/3126
* Correct xlim in force_matplotlib in cases where the signs of force are all the same by zaburo-ch in https://github.com/shap/shap/pull/2839
* Fixed ngboost explanations when col_sample < 1 by CloseChoice in https://github.com/shap/shap/pull/3294
* Fixed torch additivity check in PyTorch DeepExplainer by noxthot in https://github.com/shap/shap/pull/3281
* Replaced print statements with warnings in DeepExplainer by znacer in https://github.com/shap/shap/pull/3264
* Replace deprecated `register_backward_hook()` by noxthot in https://github.com/shap/shap/pull/3259
* Fixed deprecated use of xgboost early_stopping_rounds by CloseChoice in https://github.com/shap/shap/pull/3306
* Fixed 3rd party deprecation warnings: numba, xgboost, typing, distutils by connortann in https://github.com/shap/shap/pull/3084
* Updated the Javascript bundle to update deprecated dependencies by connortann in https://github.com/shap/shap/pull/2974
There have also been a large number of improvements to the tutorials and examples, by connortann, znacer, arshiaar, thatlittleboy, dsgibbons, owenlamont and CloseChoice
New Contributors
* 101AlexMartin made their first contribution in https://github.com/shap/shap/pull/3062
* znacer made their first contribution in https://github.com/shap/shap/pull/3112
* danieleongari made their first contribution in https://github.com/shap/shap/pull/3131
* Koen-Git made their first contribution in https://github.com/shap/shap/pull/3153
* pre-commit-ci made their first contribution in https://github.com/shap/shap/pull/3173
* owenlamont made their first contribution in https://github.com/shap/shap/pull/3199
* arshiaar made their first contribution in https://github.com/shap/shap/pull/3201
* dsgibbons made their first contribution in https://github.com/shap/shap/pull/3200
* noxthot made their first contribution in https://github.com/shap/shap/pull/3265
* zaburo-ch made their first contribution in https://github.com/shap/shap/pull/2839
* CloseChoice made their first contribution in https://github.com/shap/shap/pull/3282
**Full Changelog**: https://github.com/shap/shap/compare/v0.42.1...v0.43.0
```
### 0.42.1
```
Patch release to provide wheels for a broader range of architectures.
Added
* Added wheels for linux:aarch64 and macos:arm64 by PrimozGodec in https://github.com/slundberg/shap/pull/3078 and connortann in https://github.com/slundberg/shap/pull/3083.
Fixed
* Fixed circular import issues with shap.benchmark by thatlittleboy in https://github.com/slundberg/shap/pull/3076.
* Fixed TestPyPI releases workflow by connortann in https://github.com/slundberg/shap/pull/3068
* Fix further flaky tests by thatlittleboy in https://github.com/slundberg/shap/pull/3073
* Fix shap.summary_plot to work with matplotlib 3.6.0 by jklaise in https://github.com/slundberg/shap/pull/2697
* Fix benchmark top-level import by thatlittleboy in https://github.com/slundberg/shap/pull/3076
* Fix ipython import warning from top-level shap import by connortann in https://github.com/slundberg/shap/pull/3090
**Full Changelog**: https://github.com/slundberg/shap/compare/v0.42.0...v0.42.1
```
### 0.42.0
```
This release incorporates many changes that were originally contributed by the SHAP community via dsgibbons's [Community Fork][fork], which has now been merged into the main shap repository. PRs from this origin are labelled here as `fork123`.
This will be the last release that supports python 3.7.
[fork]: https://github.com/slundberg/shap/discussions/2942
Added
- Added support for python 3.11 ([fork72](https://github.com/dsgibbons/shap/pull/72) by connortann).
- Added `n_points` parameter to all functions in `shap.datasets` ([fork39](https://github.com/dsgibbons/shap/pull/39) by thatlittleboy).
- Added `__call__` to `KernelExplainer` ([2966](https://github.com/slundberg/shap/pull/2966) by dwolfeu).
- Added [contributing guidelines][contrib-guide] ([2996](https://github.com/slundberg/shap/pull/2996) by connortann).
[contrib-guide]: [https://github.com/slundberg/shap/blob/master/CONTRIBUTING.md]
Fixed
- Fixed `plot.waterfall` to support yticklabels with boolean features ([fork58](https://github.com/dsgibbons/shap/pull/58) by dwolfeu).
- Prevent `TreeExplainer.__call__` from throwing ValueError when passed a pandas DataFrame containing Categorical columns ([fork88](https://github.com/dsgibbons/shap/pull/88) by thatlittleboy).
- Fixed sampling in `shap.datasets` to sample without replacement ([fork36](https://github.com/dsgibbons/shap/pull/36) by thatlittleboy).
- Fixed an `UnboundLocalError` problem arising from passing a dictionary input to `shap.plots.bar` ([3001](https://github.com/slundberg/shap/pull/3000) by thatlittleboy).
- Fixed tensorflow import issue with Pyspark when using `Gradient` ([2983](https://github.com/slundberg/shap/pull/2983) by skamdar).
- Fixed the aspect ratio of the colorbar in `shap.plots.heatmap`, and use the `ax` matplotlib API internally for plotting ([3040](https://github.com/slundberg/shap/pull/3040) by thatlittleboy).
- Fixed deprecation warnings for `numba>=0.44` ([fork9](https://github.com/dsgibbons/shap/pull/9) and [fork#68](https://github.com/dsgibbons/shap/pull/68) by connortann).
- Fixed deprecation warnings for `numpy>=1.24` from numpy types ([fork7](https://github.com/dsgibbons/shap/pull/7) by dsgibbons).
- Fixed deprecation warnings for `Ipython>=8` from `Ipython.core.display` ([fork13](https://github.com/dsgibbons/shap/pull/13) by thatlittleboy).
- Fixed deprecation warnings for `tensorflow>=2.11` from `tf.optimisers` ([fork16](https://github.com/dsgibbons/shap/pull/16) by simonangerbauer).
- Fixed deprecation warnings for `sklearn>=1.2` from `sklearn.linear_model` ([fork22](https://github.com/dsgibbons/shap/pull/22) by dsgibbons).
- Fixed deprecation warnings for `xgboost>=1.4` from `ntree_limit` in tree explainer ([2987](https://github.com/slundberg/shap/pull/2987) by adnene-guessoum).
- Fixed build on Windows and MacOS ([3015](https://github.com/slundberg/shap/pull/3015) by PrimozGodec; [#3028](https://github.com/slundberg/shap/pull/3028), [#3029](https://github.com/slundberg/shap/pull/3029) and [#3031](https://github.com/slundberg/shap/pull/3031) by connortann).
- Fixed creation of ragged arrays in `shap.explainers.Exact` ([3064](https://github.com/slundberg/shap/pull/3064) by connortann).
Changed
- Updates to docstrings of several `shap.plots` functions ([3003](https://github.com/slundberg/shap/pull/3003), [#3005](https://github.com/slundberg/shap/pull/3005) by thatlittleboy).
Removed
- Deprecated the Boston house price dataset ([fork38](https://github.com/dsgibbons/shap/pull/38) by thatlittleboy).
- Removed the unused `mimic.py` file and `MimicExplainer` code ([fork53](https://github.com/dsgibbons/shap/pull/53) by thatlittleboy).
Maintenance
- Fixed failing unit tests ([fork29](https://github.com/dsgibbons/shap/pull/29) by dsgibbons, [fork#20](https://github.com/dsgibbons/shap/pull/20) by simonangerbauer, [#3044](https://github.com/slundberg/shap/pull/3044) and [fork#24](https://github.com/dsgibbons/shap/pull/24) by connortann).
- Include CUDA GPU C extension files in the source distribution ([3009](https://github.com/slundberg/shap/pull/3009) by jklaise).
- Fixed installation of package via setuptools ([fork51](https://github.com/dsgibbons/shap/pull/51) by thatlittleboy).
- Introduced a minimal set of `ruff` linting ([fork25](https://github.com/dsgibbons/shap/pull/25), [fork#26](https://github.com/dsgibbons/shap/pull/26), [fork#27](https://github.com/dsgibbons/shap/pull/27), [#2973](https://github.com/slundberg/shap/pull/2973), [#2972](https://github.com/slundberg/shap/pull/2972) and [#2976](https://github.com/slundberg/shap/pull/2976) by connortann; [#2968](https://github.com/slundberg/shap/pull/2968), [#2986](https://github.com/slundberg/shap/pull/2986) by thatlittleboy).
- Updated project metadata to PEP 517 ([3022](https://github.com/slundberg/shap/pull/3022) by connortann).
- Introduced more thorough testing on CI against newer dependencies ([fork61](https://github.com/dsgibbons/shap/pull/61) and [#3017](https://github.com/slundberg/shap/pull/3017) by connortann)
- Reduced unit test time by ~5 mins ([3046](https://github.com/slundberg/shap/pull/3046) by connortann).
- Introduced fixtures for reproducible fuzz testing ([3048](https://github.com/slundberg/shap/pull/3048) by connortann).
```
### 0.41.0
```
Lots of bugs fixes and API improvements.
- Fixed rare bug with XGBoost model loading by TheZL lrjball
- Fixed the beeswarm plot so it does not modify the passed explanation object, ravwojdyla
- Automatic wheel building using GH actions by quantumtec
- GC collection for memory in KernelExplainer by Qingtian-Zou
- Fixed max_evals params for PartitionExplainer
- JIT optimize the PartitionExplainer
- Fix colorbar formatting issues SleepyPepperHead
- New benchmark notebooks
- Use display_data for plotting when possible yuuuxt
- Improved GPUTreeShap compilation and params RAMitchell
- Fix TF API change in DeepExplainer filusn
- Add torch tensor support for plots alexander-pv
- Switch to Github actions for testing instead of Travis
- New California demo dataset swalsh1123
- Fix waterfall plot bug RichardScottOZ
- Handle missing matplotlib installation klieret
- Add linearize link support for Additive explainer (Nandish Gupta)
- Fix exceptions to be more specific alexisdrakopoulos collinb9
- Add color map option for plotting tlabarta
- Release fixed numpy version requirement rmehyde
- And many other contributions kindly made by WeichenXu123 imatiach-msft zeshengli nkthiebaut songololo GiovannaNicora joshzwiebel Ashishbodla navdeep-G smathewmanuel ycouble anubhavmaity adityasaini70 ngupta20 jckkvs abs428 JulesCollenne Tiagosf00 javirandor and Thuener
```
### 0.40.0
```
This release contains many bugs fixes and lots of new functionality, specifically for transformer based NLP models. Some highlights include:
- New plots, bug fixes, docs, and features for NLP model explanations (see docs for details).
- important permutation explainer performance fix by sander-sn
- New joint scatter plots to plot many at once on the same y-scale
- better tree model memory usage by morriskurz
- new docs by coryroyce
- new wheel building by PrimozGodec
- dark mode improvements for the docs by gialmisi
- api tweaks by c56pony nsorros jebarb
```
### 0.39.0
```
Lots of new text explainer work courtesy of ryserrao and serialization courtesy of vivekchettiar! (will note all the other changes later)
```
### 0.38.1
```
Fixes a version mismatch with the v0.38.0 release and serialization updates.
```
### 0.38.0
```
This release contains improved support for explanations of transformer text models and support for the new Explanation object based API. Specific improvements include:
- Transformer model support in the Text explainer courtesy of ryserrao
- Interventional Tree explainer GPU support courtesy of RAMitchell
- Image captioning model support courtesy of anusham1990
- Benchmarking improvements courtesy of maggiewu19
- New text and image visualizations courtesy of vivekchettiar
- New explainer serialization support courtesy of vivekchettiar
- Bug fixes for Linear explainer and the new API courtesy of heimengqi
- Fix for categorical plots courtesy of jeffreyftang
- CUDA support improvements courtesy of JohnZed
- Support for econML model courtesy of vasilismsr
- Many other bug fixes and API improvements.
```
### 0.37.0
```
This release contains more support for the new API, many bug fixes, and preliminary model agnostic text/image explainer support (still beta). Specific contributions include:
- Fix Sampling explainer sample counting issue courtesy of tcbegley
- Add multi-bar plotting support.
- Preliminary support for cohorts.
- Fixed an import error courtesy of suragnair
- Fix Tree explainer issues with isolation forests with max_features < 1 courtesy of zhanjiezhu
- Huge documentation cleanup and update courtesy of lrjball
- Typo fix courtesy of anusham1990
- Added a documentation notebook for the Exact explainer.
- Text and Image explainers courtesy of anusham1990 and Ryan Serrao
- Bug fix for shap.utils.hclust
- Initial support for InterpretML EBM models.
- Added column grouping functionality to Explainer objects.
- Fix for loop index bug in Deep explainer for PyTorch courtesy of quentinRaq
- Initial text to text visualization concepts courtesy of vivekchettiar
- Color conversion warning fix courtesy of wangjoshuah
- Fix invertibility issues in Kernel explainer with the pseudoinverse courtesy of PrimozGodec
- New benchmark code courtesy of maggiewu19 and vivekchettiar
- Other small bug fixes and enhancements.
```
### 0.36.0
```
This version contains a significant refactoring of the SHAP code base into a new (cleaner) API. Full backwards compatibility should be retained, but most things are now available in locations with the new API. Note that this API is still in a beta form, so refrain from depending on it for production code until the next release. Highlights include:
- A new shap.Explainer object that auto-chooses the explainer based on the given model and masking dataset.
- A new shap.Explanation object that allows for parallel slicing of data, SHAP values, base values (expected values), and other explanation-specific elements.
- A new shap.maskers.* module that separates the various ways to mask (i.e. perturb/hide) features from the algorithms themselves.
- A new shap.explainers.Partition explainer that can explain any text or image models very quickly.
- A new shap.maskers.Partition masker that ensures tightly grouped features are perturbed in unison, so preventing "unrealistic" model inputs from inappropriately influencing the model prediction. It also allows for the exact quadratic time computation of SHAP values for the 'structured games' (with coalitions structured according to a hierarchical clustering).
- A new shap.plots.* module with revamped plot types that all support the new API. Plots are now named more directly, so `summary_plot` (default) becomes `beeswarm`, and `dependent_plot` becomes `scatter`. Not all the plots have been ported over to the new API, but most have.
- A new notebooks/plots/* directory given examples of how to use the new plotting functions.
- A new shap.plots.bar function to directly create bar plots and also display hierarchical clustering structures to group redundant features together, and show the structure used by a Partition explainer (that relied on Owen values, which are an extension of Shapley values).
- Equally check fixes courtesy of jameslamb
- Sparse kmeans support courtesy of PrimozGodec
- Pytorch bug fixes courtesy of rightx2
- NPM JS code clean up courtesy of SachinVarghese
- Fix logit force plot bug courtesy of ehuijzer
- Decision plot documentation updates courtesy of floidgilbert
- sklearn GBM fix courtesy of ChemEngDataSci
- XGBoost 1.1 fix courtesy of lrjball
- Make SHAP spark serializable courtesy of QuentinAmbard
- Custom summary plot color maps courtesy of nasir-bhanpuri
- Support string inputs for KernelSHAP courtesy of YotamElor
- Doc fixes courtesy of imatiach-msft
- Support for GPBoost courtesy of fabsig
- Import bug fix courtesy of gracecarrillo and aokeson
```
### 0.35.0
```
This release includes:
- Better support for TensorFlow 2 (thanks imatiach-msft)
- Support for NGBoost models in TreeExplainer (thanks zhiruiwang)
- TreeExplainer support for the new sklearn.ensemble.HistGradientBoosting model.
- New improved versions of PartitionExplainer for images and text.
- IBM zOS compatibility courtesy of DorianCzichotzki.
- Support for XGBoost 1.0
- Many bug fixes courtesy of Ivan, Christian Paul, RandallJEllis, and ibuda.
```
### 0.34.0
```
This release includes:
- Many small bug fixes.
- Better matplotlib text alignment during rotation courtesy of koomie
- Cleaned up the C++ transformer code to allow easier PRs.
- Fixed a too tight check_additivity tolerance in TreeExplainer 950
- Updated the LinearExplainer API to match TreeExplainer
- Allow custom class ordering in a summary_plot courtesy of SimonStreicher
```
### 0.33.0
```
This release contains various bug fixes and new features including:
- Added PySpark support for TreeExplainer courtesy of QuentinAmbard
- A new type of plot that is an alternative to the force_plot, a `waterfall_plot`
- A new PermutationExplainer that is an alternative to KernelExplainer and SamplingExplainer.
- Added `return_variances` to GradientExplainer for PyTorch courtesy of s6juncheng
- Now we use exceptions rather than assertions in TreeExplainer courtesy of ssaamm
- Fixed image_plot transpose issue courtesy of Jimbotsai
- Fix color bar axis attachment issue courtesy of Lasse Valentini Jensen
- Fix tensor attachment issue in PyTorch courtesy of gabrieltseng
- Fix color clipping ranges in summary_pot courtesy of joelostblom
- Address sklearn 0.22 API changes courtesy of lemon-yellow
- Ensure matplotlib is optional courtesy of imatiach-msft
```
### 0.32.1
```
This release is just intended to push better auto-deploy bundles out of travis and appveyor.
```
### 0.32.0
```
This release includes:
- Support for sklearn isolation forest courtesy of JiechengZhao
- New check_additivity tests to ensure no errors in DeepExplainer and TreeExplainer
- Fix 861, 860
- Fix missing readme example html file
- Support for spark decision tree regressor courtesy of QuentinAmbard
- Better safe isinstance checking courtesy of parsatorb
- Fix eager execution in TF < 2 courtesy of bottydim
```
### 0.31.0
```
This release contains several new features and bug fixes:
- GradientExplainer now supports TensorFlow 2.0.
- We now do a lazy load of the plotting dependencies, which means a pip install no longer needs to also pull in matplotlib, skimage, and ipython. This should make installs much lighter, especially those that don't need plotting :)
- Added a new BruteForceExplainer for easy testing and comparison on small problems.
- Added a new partial_dependence_plot function. This function will be used to illustrate the close connections between partial dependence plots and SHAP values in future example notebooks.
- Handle the multiclass case with no intercept in LinearExplainer courtesy of gabrieltseng
- Some extras_require options during the pip install courtesy of AbdealiJK
- Other small bug fixes and updates
```
### 0.30.2
```
This release is primarily to remove a dependency on dill that was not in setup.py. It also includes:
- A typo fix in force.py courtesy of jonlwowski012
- Test code cleanup courtesy of jorgecarleitao
```
### 0.30.1
```
- Fix floating point rounding mismatches in recent sklearn versions of tree models
- An update to allow easier loading of custom tree ensemble models by TreeExplainer.
- `decision_plot` documentation updates courtesy of floidgilbert
```
Links
- PyPI: https://pypi.org/project/shap
- Changelog: https://data.safetycli.com/changelogs/shap/
This PR updates shap from 0.30.0 to 0.44.0.
Changelog
### 0.44.0 ``` This release contains a number enhancements and bug fixes. What's Changed Added * Faster and more stable linear solver in KernelShap by lorentzenchr in https://github.com/shap/shap/pull/3271 * Enabled passing of `ax` to `group_difference()` plot by mtlulka in https://github.com/shap/shap/pull/3355 * Added support for Explanation.display_data in bar plot by fountaindive in https://github.com/shap/shap/pull/3386 * Improved build messages when building from source by connortann in https://github.com/shap/shap/pull/3403 Fixed * Fixed `CatboostClassifier` explanations with feature interactions on Windows by CloseChoice in https://github.com/shap/shap/pull/3325 * Fixed passing of Xgboost model parameters to xgboost.DMatrix by vancromy in https://github.com/shap/shap/pull/3314 * Explicit specification of xgboost>=1.4 constraint by mtlulka in https://github.com/shap/shap/pull/3352 * Fixed conversion of DMatrix to CSR matrix by thatlittleboy in https://github.com/shap/shap/pull/3359 * Removed deprecated `use_line_collection` in `dependence_plot` by CloseChoice in https://github.com/shap/shap/pull/3369 * Fixed bug relating to array reshaping in `scatter` plots by SomeUserName1 in https://github.com/shap/shap/pull/2799 Documentation * A large number of [example notebooks](https://shap.readthedocs.io/en/latest) fixed and updated by connortann, znacer , thatlittleboy, CloseChoice and stompsjo New Contributors * vancromy made their first contribution in https://github.com/shap/shap/pull/3314 * lorentzenchr made their first contribution in https://github.com/shap/shap/pull/3271 * mtlulka made their first contribution in https://github.com/shap/shap/pull/3352 * fountaindive made their first contribution in https://github.com/shap/shap/pull/3386 * SomeUserName1 made their first contribution in https://github.com/shap/shap/pull/2799 * stompsjo made their first contribution in https://github.com/shap/shap/pull/3391 **Full Changelog**: https://github.com/shap/shap/compare/v0.43.0...V0.44.0 ``` ### 0.43.0 ``` What's Changed This release contains a number of bug fixes and improvements. Following the [NEP 29 deprecation policy](https://numpy.org/neps/nep-0029-deprecation_policy.html), this release drops support for python 3.7. Breaking changes * Removed the deprecated Boston dataset by thatlittleboy in https://github.com/shap/shap/pull/3316 * The shape of `Explanation.base_values` has been standardised between different TreeExplainer models to always be of shape `(N,)` and not `(N,1)`. By thatlittleboy in https://github.com/shap/shap/pull/3121 Added * Added additivity check to Pytorch DeepExplainer (activated by default) by noxthot in https://github.com/shap/shap/pull/3265 * Added flag to allow the printing of the mean SHAP value in the legend of a multi-output bar plot. By 101AlexMartin in https://github.com/shap/shap/pull/3062 * Added heatmap and violin plot to top-level API by connortann in https://github.com/shap/shap/pull/3157 * Replaced all tqdm imports with tqdm.auto by owenlamont in https://github.com/shap/shap/pull/3199 Fixed * Fixed segmentation faults on MacOS with lightgbm tests (with newer libomp versions) by thatlittleboy in https://github.com/shap/shap/pull/3093 * Support LightGBM ensemble containing single leaf trees (stump) by thatlittleboy in https://github.com/shap/shap/pull/3094 * Fixed conversion DataFrame to ndarray for Explanation.data by danieleongari in https://github.com/shap/shap/pull/3131 * Fixed waterfall plot on explanations of sklearn tree models by connortann in https://github.com/shap/shap/pull/3138 * Fixed pandas input for gradient explainer by Koen-Git in https://github.com/shap/shap/pull/3153 * Fixed slicing of `feature_names` in Explanation objects with square `.values` by thatlittleboy in https://github.com/shap/shap/pull/3126 * Correct xlim in force_matplotlib in cases where the signs of force are all the same by zaburo-ch in https://github.com/shap/shap/pull/2839 * Fixed ngboost explanations when col_sample < 1 by CloseChoice in https://github.com/shap/shap/pull/3294 * Fixed torch additivity check in PyTorch DeepExplainer by noxthot in https://github.com/shap/shap/pull/3281 * Replaced print statements with warnings in DeepExplainer by znacer in https://github.com/shap/shap/pull/3264 * Replace deprecated `register_backward_hook()` by noxthot in https://github.com/shap/shap/pull/3259 * Fixed deprecated use of xgboost early_stopping_rounds by CloseChoice in https://github.com/shap/shap/pull/3306 * Fixed 3rd party deprecation warnings: numba, xgboost, typing, distutils by connortann in https://github.com/shap/shap/pull/3084 * Updated the Javascript bundle to update deprecated dependencies by connortann in https://github.com/shap/shap/pull/2974 There have also been a large number of improvements to the tutorials and examples, by connortann, znacer, arshiaar, thatlittleboy, dsgibbons, owenlamont and CloseChoice New Contributors * 101AlexMartin made their first contribution in https://github.com/shap/shap/pull/3062 * znacer made their first contribution in https://github.com/shap/shap/pull/3112 * danieleongari made their first contribution in https://github.com/shap/shap/pull/3131 * Koen-Git made their first contribution in https://github.com/shap/shap/pull/3153 * pre-commit-ci made their first contribution in https://github.com/shap/shap/pull/3173 * owenlamont made their first contribution in https://github.com/shap/shap/pull/3199 * arshiaar made their first contribution in https://github.com/shap/shap/pull/3201 * dsgibbons made their first contribution in https://github.com/shap/shap/pull/3200 * noxthot made their first contribution in https://github.com/shap/shap/pull/3265 * zaburo-ch made their first contribution in https://github.com/shap/shap/pull/2839 * CloseChoice made their first contribution in https://github.com/shap/shap/pull/3282 **Full Changelog**: https://github.com/shap/shap/compare/v0.42.1...v0.43.0 ``` ### 0.42.1 ``` Patch release to provide wheels for a broader range of architectures. Added * Added wheels for linux:aarch64 and macos:arm64 by PrimozGodec in https://github.com/slundberg/shap/pull/3078 and connortann in https://github.com/slundberg/shap/pull/3083. Fixed * Fixed circular import issues with shap.benchmark by thatlittleboy in https://github.com/slundberg/shap/pull/3076. * Fixed TestPyPI releases workflow by connortann in https://github.com/slundberg/shap/pull/3068 * Fix further flaky tests by thatlittleboy in https://github.com/slundberg/shap/pull/3073 * Fix shap.summary_plot to work with matplotlib 3.6.0 by jklaise in https://github.com/slundberg/shap/pull/2697 * Fix benchmark top-level import by thatlittleboy in https://github.com/slundberg/shap/pull/3076 * Fix ipython import warning from top-level shap import by connortann in https://github.com/slundberg/shap/pull/3090 **Full Changelog**: https://github.com/slundberg/shap/compare/v0.42.0...v0.42.1 ``` ### 0.42.0 ``` This release incorporates many changes that were originally contributed by the SHAP community via dsgibbons's [Community Fork][fork], which has now been merged into the main shap repository. PRs from this origin are labelled here as `fork123`. This will be the last release that supports python 3.7. [fork]: https://github.com/slundberg/shap/discussions/2942 Added - Added support for python 3.11 ([fork72](https://github.com/dsgibbons/shap/pull/72) by connortann). - Added `n_points` parameter to all functions in `shap.datasets` ([fork39](https://github.com/dsgibbons/shap/pull/39) by thatlittleboy). - Added `__call__` to `KernelExplainer` ([2966](https://github.com/slundberg/shap/pull/2966) by dwolfeu). - Added [contributing guidelines][contrib-guide] ([2996](https://github.com/slundberg/shap/pull/2996) by connortann). [contrib-guide]: [https://github.com/slundberg/shap/blob/master/CONTRIBUTING.md] Fixed - Fixed `plot.waterfall` to support yticklabels with boolean features ([fork58](https://github.com/dsgibbons/shap/pull/58) by dwolfeu). - Prevent `TreeExplainer.__call__` from throwing ValueError when passed a pandas DataFrame containing Categorical columns ([fork88](https://github.com/dsgibbons/shap/pull/88) by thatlittleboy). - Fixed sampling in `shap.datasets` to sample without replacement ([fork36](https://github.com/dsgibbons/shap/pull/36) by thatlittleboy). - Fixed an `UnboundLocalError` problem arising from passing a dictionary input to `shap.plots.bar` ([3001](https://github.com/slundberg/shap/pull/3000) by thatlittleboy). - Fixed tensorflow import issue with Pyspark when using `Gradient` ([2983](https://github.com/slundberg/shap/pull/2983) by skamdar). - Fixed the aspect ratio of the colorbar in `shap.plots.heatmap`, and use the `ax` matplotlib API internally for plotting ([3040](https://github.com/slundberg/shap/pull/3040) by thatlittleboy). - Fixed deprecation warnings for `numba>=0.44` ([fork9](https://github.com/dsgibbons/shap/pull/9) and [fork#68](https://github.com/dsgibbons/shap/pull/68) by connortann). - Fixed deprecation warnings for `numpy>=1.24` from numpy types ([fork7](https://github.com/dsgibbons/shap/pull/7) by dsgibbons). - Fixed deprecation warnings for `Ipython>=8` from `Ipython.core.display` ([fork13](https://github.com/dsgibbons/shap/pull/13) by thatlittleboy). - Fixed deprecation warnings for `tensorflow>=2.11` from `tf.optimisers` ([fork16](https://github.com/dsgibbons/shap/pull/16) by simonangerbauer). - Fixed deprecation warnings for `sklearn>=1.2` from `sklearn.linear_model` ([fork22](https://github.com/dsgibbons/shap/pull/22) by dsgibbons). - Fixed deprecation warnings for `xgboost>=1.4` from `ntree_limit` in tree explainer ([2987](https://github.com/slundberg/shap/pull/2987) by adnene-guessoum). - Fixed build on Windows and MacOS ([3015](https://github.com/slundberg/shap/pull/3015) by PrimozGodec; [#3028](https://github.com/slundberg/shap/pull/3028), [#3029](https://github.com/slundberg/shap/pull/3029) and [#3031](https://github.com/slundberg/shap/pull/3031) by connortann). - Fixed creation of ragged arrays in `shap.explainers.Exact` ([3064](https://github.com/slundberg/shap/pull/3064) by connortann). Changed - Updates to docstrings of several `shap.plots` functions ([3003](https://github.com/slundberg/shap/pull/3003), [#3005](https://github.com/slundberg/shap/pull/3005) by thatlittleboy). Removed - Deprecated the Boston house price dataset ([fork38](https://github.com/dsgibbons/shap/pull/38) by thatlittleboy). - Removed the unused `mimic.py` file and `MimicExplainer` code ([fork53](https://github.com/dsgibbons/shap/pull/53) by thatlittleboy). Maintenance - Fixed failing unit tests ([fork29](https://github.com/dsgibbons/shap/pull/29) by dsgibbons, [fork#20](https://github.com/dsgibbons/shap/pull/20) by simonangerbauer, [#3044](https://github.com/slundberg/shap/pull/3044) and [fork#24](https://github.com/dsgibbons/shap/pull/24) by connortann). - Include CUDA GPU C extension files in the source distribution ([3009](https://github.com/slundberg/shap/pull/3009) by jklaise). - Fixed installation of package via setuptools ([fork51](https://github.com/dsgibbons/shap/pull/51) by thatlittleboy). - Introduced a minimal set of `ruff` linting ([fork25](https://github.com/dsgibbons/shap/pull/25), [fork#26](https://github.com/dsgibbons/shap/pull/26), [fork#27](https://github.com/dsgibbons/shap/pull/27), [#2973](https://github.com/slundberg/shap/pull/2973), [#2972](https://github.com/slundberg/shap/pull/2972) and [#2976](https://github.com/slundberg/shap/pull/2976) by connortann; [#2968](https://github.com/slundberg/shap/pull/2968), [#2986](https://github.com/slundberg/shap/pull/2986) by thatlittleboy). - Updated project metadata to PEP 517 ([3022](https://github.com/slundberg/shap/pull/3022) by connortann). - Introduced more thorough testing on CI against newer dependencies ([fork61](https://github.com/dsgibbons/shap/pull/61) and [#3017](https://github.com/slundberg/shap/pull/3017) by connortann) - Reduced unit test time by ~5 mins ([3046](https://github.com/slundberg/shap/pull/3046) by connortann). - Introduced fixtures for reproducible fuzz testing ([3048](https://github.com/slundberg/shap/pull/3048) by connortann). ``` ### 0.41.0 ``` Lots of bugs fixes and API improvements. - Fixed rare bug with XGBoost model loading by TheZL lrjball - Fixed the beeswarm plot so it does not modify the passed explanation object, ravwojdyla - Automatic wheel building using GH actions by quantumtec - GC collection for memory in KernelExplainer by Qingtian-Zou - Fixed max_evals params for PartitionExplainer - JIT optimize the PartitionExplainer - Fix colorbar formatting issues SleepyPepperHead - New benchmark notebooks - Use display_data for plotting when possible yuuuxt - Improved GPUTreeShap compilation and params RAMitchell - Fix TF API change in DeepExplainer filusn - Add torch tensor support for plots alexander-pv - Switch to Github actions for testing instead of Travis - New California demo dataset swalsh1123 - Fix waterfall plot bug RichardScottOZ - Handle missing matplotlib installation klieret - Add linearize link support for Additive explainer (Nandish Gupta) - Fix exceptions to be more specific alexisdrakopoulos collinb9 - Add color map option for plotting tlabarta - Release fixed numpy version requirement rmehyde - And many other contributions kindly made by WeichenXu123 imatiach-msft zeshengli nkthiebaut songololo GiovannaNicora joshzwiebel Ashishbodla navdeep-G smathewmanuel ycouble anubhavmaity adityasaini70 ngupta20 jckkvs abs428 JulesCollenne Tiagosf00 javirandor and Thuener ``` ### 0.40.0 ``` This release contains many bugs fixes and lots of new functionality, specifically for transformer based NLP models. Some highlights include: - New plots, bug fixes, docs, and features for NLP model explanations (see docs for details). - important permutation explainer performance fix by sander-sn - New joint scatter plots to plot many at once on the same y-scale - better tree model memory usage by morriskurz - new docs by coryroyce - new wheel building by PrimozGodec - dark mode improvements for the docs by gialmisi - api tweaks by c56pony nsorros jebarb ``` ### 0.39.0 ``` Lots of new text explainer work courtesy of ryserrao and serialization courtesy of vivekchettiar! (will note all the other changes later) ``` ### 0.38.1 ``` Fixes a version mismatch with the v0.38.0 release and serialization updates. ``` ### 0.38.0 ``` This release contains improved support for explanations of transformer text models and support for the new Explanation object based API. Specific improvements include: - Transformer model support in the Text explainer courtesy of ryserrao - Interventional Tree explainer GPU support courtesy of RAMitchell - Image captioning model support courtesy of anusham1990 - Benchmarking improvements courtesy of maggiewu19 - New text and image visualizations courtesy of vivekchettiar - New explainer serialization support courtesy of vivekchettiar - Bug fixes for Linear explainer and the new API courtesy of heimengqi - Fix for categorical plots courtesy of jeffreyftang - CUDA support improvements courtesy of JohnZed - Support for econML model courtesy of vasilismsr - Many other bug fixes and API improvements. ``` ### 0.37.0 ``` This release contains more support for the new API, many bug fixes, and preliminary model agnostic text/image explainer support (still beta). Specific contributions include: - Fix Sampling explainer sample counting issue courtesy of tcbegley - Add multi-bar plotting support. - Preliminary support for cohorts. - Fixed an import error courtesy of suragnair - Fix Tree explainer issues with isolation forests with max_features < 1 courtesy of zhanjiezhu - Huge documentation cleanup and update courtesy of lrjball - Typo fix courtesy of anusham1990 - Added a documentation notebook for the Exact explainer. - Text and Image explainers courtesy of anusham1990 and Ryan Serrao - Bug fix for shap.utils.hclust - Initial support for InterpretML EBM models. - Added column grouping functionality to Explainer objects. - Fix for loop index bug in Deep explainer for PyTorch courtesy of quentinRaq - Initial text to text visualization concepts courtesy of vivekchettiar - Color conversion warning fix courtesy of wangjoshuah - Fix invertibility issues in Kernel explainer with the pseudoinverse courtesy of PrimozGodec - New benchmark code courtesy of maggiewu19 and vivekchettiar - Other small bug fixes and enhancements. ``` ### 0.36.0 ``` This version contains a significant refactoring of the SHAP code base into a new (cleaner) API. Full backwards compatibility should be retained, but most things are now available in locations with the new API. Note that this API is still in a beta form, so refrain from depending on it for production code until the next release. Highlights include: - A new shap.Explainer object that auto-chooses the explainer based on the given model and masking dataset. - A new shap.Explanation object that allows for parallel slicing of data, SHAP values, base values (expected values), and other explanation-specific elements. - A new shap.maskers.* module that separates the various ways to mask (i.e. perturb/hide) features from the algorithms themselves. - A new shap.explainers.Partition explainer that can explain any text or image models very quickly. - A new shap.maskers.Partition masker that ensures tightly grouped features are perturbed in unison, so preventing "unrealistic" model inputs from inappropriately influencing the model prediction. It also allows for the exact quadratic time computation of SHAP values for the 'structured games' (with coalitions structured according to a hierarchical clustering). - A new shap.plots.* module with revamped plot types that all support the new API. Plots are now named more directly, so `summary_plot` (default) becomes `beeswarm`, and `dependent_plot` becomes `scatter`. Not all the plots have been ported over to the new API, but most have. - A new notebooks/plots/* directory given examples of how to use the new plotting functions. - A new shap.plots.bar function to directly create bar plots and also display hierarchical clustering structures to group redundant features together, and show the structure used by a Partition explainer (that relied on Owen values, which are an extension of Shapley values). - Equally check fixes courtesy of jameslamb - Sparse kmeans support courtesy of PrimozGodec - Pytorch bug fixes courtesy of rightx2 - NPM JS code clean up courtesy of SachinVarghese - Fix logit force plot bug courtesy of ehuijzer - Decision plot documentation updates courtesy of floidgilbert - sklearn GBM fix courtesy of ChemEngDataSci - XGBoost 1.1 fix courtesy of lrjball - Make SHAP spark serializable courtesy of QuentinAmbard - Custom summary plot color maps courtesy of nasir-bhanpuri - Support string inputs for KernelSHAP courtesy of YotamElor - Doc fixes courtesy of imatiach-msft - Support for GPBoost courtesy of fabsig - Import bug fix courtesy of gracecarrillo and aokeson ``` ### 0.35.0 ``` This release includes: - Better support for TensorFlow 2 (thanks imatiach-msft) - Support for NGBoost models in TreeExplainer (thanks zhiruiwang) - TreeExplainer support for the new sklearn.ensemble.HistGradientBoosting model. - New improved versions of PartitionExplainer for images and text. - IBM zOS compatibility courtesy of DorianCzichotzki. - Support for XGBoost 1.0 - Many bug fixes courtesy of Ivan, Christian Paul, RandallJEllis, and ibuda. ``` ### 0.34.0 ``` This release includes: - Many small bug fixes. - Better matplotlib text alignment during rotation courtesy of koomie - Cleaned up the C++ transformer code to allow easier PRs. - Fixed a too tight check_additivity tolerance in TreeExplainer 950 - Updated the LinearExplainer API to match TreeExplainer - Allow custom class ordering in a summary_plot courtesy of SimonStreicher ``` ### 0.33.0 ``` This release contains various bug fixes and new features including: - Added PySpark support for TreeExplainer courtesy of QuentinAmbard - A new type of plot that is an alternative to the force_plot, a `waterfall_plot` - A new PermutationExplainer that is an alternative to KernelExplainer and SamplingExplainer. - Added `return_variances` to GradientExplainer for PyTorch courtesy of s6juncheng - Now we use exceptions rather than assertions in TreeExplainer courtesy of ssaamm - Fixed image_plot transpose issue courtesy of Jimbotsai - Fix color bar axis attachment issue courtesy of Lasse Valentini Jensen - Fix tensor attachment issue in PyTorch courtesy of gabrieltseng - Fix color clipping ranges in summary_pot courtesy of joelostblom - Address sklearn 0.22 API changes courtesy of lemon-yellow - Ensure matplotlib is optional courtesy of imatiach-msft ``` ### 0.32.1 ``` This release is just intended to push better auto-deploy bundles out of travis and appveyor. ``` ### 0.32.0 ``` This release includes: - Support for sklearn isolation forest courtesy of JiechengZhao - New check_additivity tests to ensure no errors in DeepExplainer and TreeExplainer - Fix 861, 860 - Fix missing readme example html file - Support for spark decision tree regressor courtesy of QuentinAmbard - Better safe isinstance checking courtesy of parsatorb - Fix eager execution in TF < 2 courtesy of bottydim ``` ### 0.31.0 ``` This release contains several new features and bug fixes: - GradientExplainer now supports TensorFlow 2.0. - We now do a lazy load of the plotting dependencies, which means a pip install no longer needs to also pull in matplotlib, skimage, and ipython. This should make installs much lighter, especially those that don't need plotting :) - Added a new BruteForceExplainer for easy testing and comparison on small problems. - Added a new partial_dependence_plot function. This function will be used to illustrate the close connections between partial dependence plots and SHAP values in future example notebooks. - Handle the multiclass case with no intercept in LinearExplainer courtesy of gabrieltseng - Some extras_require options during the pip install courtesy of AbdealiJK - Other small bug fixes and updates ``` ### 0.30.2 ``` This release is primarily to remove a dependency on dill that was not in setup.py. It also includes: - A typo fix in force.py courtesy of jonlwowski012 - Test code cleanup courtesy of jorgecarleitao ``` ### 0.30.1 ``` - Fix floating point rounding mismatches in recent sklearn versions of tree models - An update to allow easier loading of custom tree ensemble models by TreeExplainer. - `decision_plot` documentation updates courtesy of floidgilbert ```Links
- PyPI: https://pypi.org/project/shap - Changelog: https://data.safetycli.com/changelogs/shap/