Releases: mmschlk/shapiq
v1.2.0 (2024-11-15)
New Features
- adds
shapiq.TabPFNExplainer
as a specialized version of theshapiq.TabularExplainer
which offers a streamlined variant of the explainer for the TabPFN model #301 - adds a TabPFN example notebook to the documentation
- adds the
sentence_plot
function to theplot
module to visualize the contributions of words to a language model prediction in a sentence-like format - adds support for IsoForest models to explainer and tree explainer #278
- adds the
upset_plot
function to theplot
module to visualize the interactions of higher-order #290
API Enhancements
- handles
explainer.explain()
now through a common interface for all explainer classes which now need to implement aexplain_function()
method - adds the baseline_value into the InteractionValues object's value storage for the
()
interaction ifmin_order=0
(default usually) for all indices that are not ``SII```(SII has another baseline value) such that the values are efficient (sum up to the model prediction) without the awkward handling of the baseline_value attribute - renames
game_fun
parameter inshapiq.ExactComputer
togame
#297 - refactors game theory computations like
ExactComputer
,MoebiusConverter
,core
, among others to be more modular and flexible into thegame_theory
module #258 - removes warning when class_index is not provided in explainers #298
- makes abbreviations in the
plot
module optional #281 - adds support for sub-selection of players in the interaction values data class #276 which allows retrieving interaction values for a subset of players
Tests Enhancements
- improves quality of the tests by adding many more semantic tests to the different interaction indices and computations #285
New Contributors
- @JuliaHerbinger made their first contribution in #287
- @r-visser made their first contribution in #289
- @heinzll made their first contribution in #285
Full Changelog: v1.1.1...v1.2.0
v1.1.1 (2024-11-13)
Improvements and Ease of Use
- adds a
class_index
parameter toTabularExplainer
andExplainer
to specify the class index to be explained for classification models #271 (renamesclass_label
parameter in TreeExplainer toclass_index
) - adds support for
PyTorch
models toExplainer
#272 - adds new tests comparing
shapiq
outputs for SVs with alues computed withshap
- adds new tests for checking
shapiq
explainers with different types of models
Bug Fixes
- fixes a bug that
RandomForestClassifier
models were not working with theTreeExplainer
#273
v1.1.0 (2024-11-07)
New Features and Improvements
- adds computation of the Egalitarian Core (
EC
) and Egalitarian Least-Core (ELC
) to theExactComputer
#182 - adds
waterfall_plot
#34 that visualizes the contributions of features to the model prediction - adds
BaselineImputer
#107 which is now responsible for handling thesample_replacements
parameter. Added a DeprecationWarning for the parameter inMarginalImputer
, which will be removed in the next release. - adds
joint_marginal_distribution
parameter toMarginalImputer
with default valueTrue
#261 - renames explanation graph to
si_graph
get_n_order
now has optional lower/upper limits for the order- computing metrics for benchmarking now tries to resolve not-matching interaction indices and will throw a warning instead of a ValueError #179
- add a legend to benchmark plots #170
- refactored the
shapiq.games.benchmark
module into a separateshapiq.benchmark
module by moving all but the benchmark games into the new module. This closes #169 and makes benchmarking more flexible and convenient. - a
shapiq.Game
can now be called more intuitively with coalitions data types (tuples of int or str) and also allows to addplayer_names
to the game at initialization #183 - improve tests across the package
Documentation
- adds a notebook showing how to use custom tree models with the
TreeExplainer
#66 - adds a notebook show how to use the
shapiq.Game
API to create custom games #184 - adds a notebook showing hot to visualize interactions #252
- adds a notebook showing how to compute Shapley values with
shapiq
#193 - adds a notebook for conducting data valuation #190
- adds a notebook showcasing introducing the Core and how to compute it with
shapiq
#191
Bug Fixes
- fixes a bug with SIs not adding up to the model prediction because of wrong values in the empty set #264
- fixes a bug that
TreeExplainer
did not have the correct baseline_value when using XGBoost models #250 - fixes the force plot not showing and its baseline value
New Contributors
- @Advueu963 made their first contribution in #185
- @dependabot made their first contribution in #200
Full Changelog: v1.0.1...v1.1.0
v1.0.1 (2024-06-05)
- add
max_order=1
toTabularExplainer
andTreeExplainer
- fix
TreeExplainer.explain_X(..., n_jobs=2, random_state=0)
shapiq v1.0.0 (2024-06-04)
Major release of the shapiq
Python package including (among others):
approximator
module implements over 10 approximators of Shapley values and interaction indices.exact
module implements a computer for over 10 game theoretic concepts like interaction indices or generalized values.games
module implements over 10 application benchmarks for the approximators.explainer
module includes aTabularExplainer
andTreeExplainer
for any-order feature interactions of machine learning model predictions.interaction_values
module implements a data class to store and analyze interaction values.plot
module allows visualizing interaction values.datasets
module loads datasets for testing and examples.
Documentation of shapiq
with tutorials and API reference is available at https://shapiq.readthedocs.io
Update v.0.0.6-alpha
Highlights
The highlights of this release are as follows.
Random Forest Support for TreeExplainer
We add support for RandomForestClassifier
and RandomForestRegressor
as provided by sklearn.ensemble
in the TreeExplainer
. This is discussed in #55.
TreeExplainer Bugfix
We fix a package-breaking bug that made it impossible to use the TreeExplainer
class.
Additional Unittests
We add additional unittests that fully covers the TreeExplainer
in its current form.
What's Changed
Full Changelog: v.0.0.5-alpha...v.0.0.6-alpha
Update v.0.0.5-alpha
Highlights
Since the last release already is some time back, lot's has changed. The highlights are as follows:
TreeExplainer based on TreeSHAP-IQ
shapiq
now is equipped with a TreeExplainer
. The TreeExplainer
is based on the TreeSHAP-IQ algorithm proposed in this paper. It is a model-specific method to compute Shapley interactions of all kinds and any-order. Since it is based on the linear TreeSHAP algorithm it is quite fast. The work is not yet finished on the TreeExplainer, since it only accepts very basic tree models from sklearn as input. More to follow on this front.
The first visualizations are added.
We added a new plot to the visualizations: the stacked bar chart (underwhelming name). This plot is illustrated in the TreeSHAP-IQ paper and Sebastian Bordt and Ulrike von Luxburg's AISTATS paper. The stacked bar charts shows how much interaction is present in a specific instance and is based on the k-SII
values.
Major Refactoring
The codebase has changed quite drastically and many objects have been renamed (e.g. InteractionExplainer
has been renamed to Tabular Explainer
to better fit the more specific intend of this class). The InteractionValues
(the main data structure of the package) has become much more powerful. You can now multiply scalar values to the interaction scores and even add two objects together.
Welcoming new Collaborators
We still are looking for all the help that we can get! If you want to contribute please check out the tutorial and our project.
What's Changed
- Add nSII and SII Regression Estimator by @mmschlk in #22
- Merge Dev by @mmschlk in #23
- Add initial explainer. by @mmschlk in #25
- Development by @mmschlk in #27
- Merge by @mmschlk in #28
- Add additional Tests by @mmschlk in #29
- Adds Stacked Bar Plot and tidyies up Network Plot. by @mmschlk in #41
- Renamed nSII to k-SII and refactors base approximators by @mmschlk in #42
- Add Collaborator Tutorial and Code of Conduct by @mmschlk in #46
- adds code-quality check and closes #45 by @mmschlk in #47
- adds TreeExplainer with TreeSHAP-IQ by @mmschlk in #51
Full Changelog: v.0.0.4-alpha...v.0.0.5-alpha
Update v.0.0.4-alpha
New Approximators
This release adds new approximation methods to shapiq
and makes all interaction calculations faster and more memory efficient.
ShapIQ approximator
This release adds the shapiq.approximator.ShapIQ
approximator as proposed in this paper (NeurIPS'23).
ShapIQ
can approximate any cardinal interaction index (CII) like the Shapley Interaction Index (SII), the Shapley Taylor Index (STI), or the Faithful Shapley Interaction index (FSI).
Regression Estimator for FSI
The shapiq.approximator.RegressionFSI
regression estimator, which is only available for FSI, was proposed in this paper (JMLR'23). It is similar to KernelSHAP in that it leverages a weighted least squares representation for the interaction index and solves this by estimating this regression problem.
Permutation Sampling for STI
The permutation sampling currently implemented for the SII (shapiq.approximator.PermutationSamplingSII
) can also be extended to the STI. The new shapiq.approximator.PermutationSamplingSTI
uses the traditional permutation sampling approach to compute STI scores.
List of PRs
- Add FSI and STI approximation methods by @mmschlk in #7
- Add SHAP-IQ approximator by @mmschlk in #10
- Tests and Efficiency by @mmschlk in #18
- Updates docs. by @mmschlk in #20
Full Changelog: v0.0.3-alpha...v.0.0.4-alpha
Update v.0.0.3-alpha
0.0.2
Adds network plot functionality and updates docs. This release is mainly used to test the workflows and publish of docs and automatic update to pypi.