Skip to content

Commit 5174890

Browse files
authored
🏷️ Create v1.2.3 Release (#351)
* update version * ran first notebooks * ran core * add jupyter to dependencies * ran long notebooks * ran notebooks * ran sklearn * ran tabpfn * ran remaining notebooks * updated contribution page to include uv and some details about different changes
1 parent 56e1ea4 commit 5174890

20 files changed

+2089
-995
lines changed

.github/CONTRIBUTING.md

+56-56
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
11
# ✌️ Contributing Guidelines
22

3-
This document outlines the guidelines for contributing to the project. It should enable contributors
4-
to understand the process for applying changes to the project and how to interact with the community.
3+
This document outlines how to easily contribute to the project.
54
For the code of conduct, please refer to the [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
65

76
## 🗺️ What to Work On
8-
First, we welcome contributions from everyone in every form. If you feel that something is missing
9-
or could be improved, feel free to change it. However, to streamline the process of contributing
10-
higher-tier changes or features to the project, we maintain an open
11-
[roadmap](https://github.com/users/mmschlk/projects/4/views/4). There, we collect ideas and features
12-
that we want to add to the project. If you want to work on something, please check the roadmap first
13-
to see if the feature is already planned or if there is a similar feature that you could contribute
14-
to.
15-
16-
### 🙏 Discussions
7+
First, we welcome contributions **from everyone** in **every form**. If you feel that something is
8+
missing or could be improved, feel free to change it. However, to streamline the process of
9+
contributing higher-tier changes or features to the project, we maintain an open
10+
[roadmap](https://github.com/users/mmschlk/projects/4/views/4) which is just storing all the ideas
11+
and problems found on shapiq's [issues page](https://github.com/mmschlk/shapiq/issues). If you want
12+
to work on something, check out the roadmap or issues first to see if the feature is already
13+
planned or if there is a similar feature that you could contribute to.
14+
15+
Here are some examples of what we are very happy to receive contributions for:
16+
17+
### Approximators
18+
We are always looking for new approximators to add to `shapiq`. Approximators are always extending
19+
the base class `Approximator` and implementing `approximate` method. Make sure to create unit tests
20+
for the new approximator.
21+
22+
### Explainers
23+
If you want to add a new explainer, you can extend the base class `Explainer` and implement the
24+
`explain_function` method. Make sure to create unit tests for the new explainer. Note that
25+
explainers are quite elaborate, so it is a very good idea to open a discussion before starting to
26+
work on a new explainer.
27+
28+
### Model Support
29+
You like a particular machine learning model and it is not yet supported by `shapiq`? Maybe you can
30+
add support in the [transformation code](https://github.com/mmschlk/shapiq/blob/56e1ea4a41d185b8364ca8e6370a01646dd792c6/shapiq/explainer/utils.py#L1) or [tree/validation](https://github.com/mmschlk/shapiq/blob/56e1ea4a41d185b8364ca8e6370a01646dd792c6/shapiq/explainer/tree/validation.py).
31+
Make sure to add tests for the new model as part of the unit tests (you can find the tests of the
32+
other model types).
33+
34+
### Visualizations
35+
If you have a nice idea to visualize Shapley values or Shapley interaction values, you can add a new
36+
visualization to the `shapiq.plot` package. Make sure that plots are also available through the
37+
`InteractionValues` object like the other plots (e.g. `InteractionValues.plot_force`). Make sure to
38+
add tests for the new visualization.
39+
40+
### 🙏 Discussions and Issues
1741
If you have an idea for a new feature or a change, we encourage everyone to open a discussion in the
18-
[Discussions](https://github.com/mmschlk/shapiq/discussions/new/choose) section.
42+
[Discussions](https://github.com/mmschlk/shapiq/discussions/new/choose) section or open an [issues](https://github.com/mmschlk/shapiq/issues).
1943
We encourage you to open a discussion so that we can align on the work to be done. It's generally a
2044
good idea to have a quick discussion before opening a pull request that is potentially out-of-scope.
2145

@@ -39,52 +63,37 @@ git clone https://github.com/mmschlk/shapiq/
3963
```
4064

4165
Next you need a python environment with a supported version of python. We recommend using
42-
[pyenv](https://github.com/pyenv/pyenv-installer). Once you have pyenv, you can install the latest
43-
Python version `shapiq` supports:
66+
[uv](https://docs.astral.sh/uv/getting-started/installation), which works extremely fast and helps
67+
to stay up-to-date with the latest Python versions. With `uv`, you can set up your development
68+
environment with the following command:
4469

4570
```sh
46-
pyenv install 3.10
71+
uv sync --all-extras --dev
4772
```
4873

49-
Then, create a virtual environment and install the development dependencies:
74+
Now you are all set up and ready to go.
5075

51-
```sh
52-
cd shapiq
53-
python -m venv .venv
54-
source .venv/bin/activate
55-
pip install -e .[dev]
56-
```
5776

58-
---
59-
> 📝 **Note**: Since `shapiq` uses the `requests` library, you might need to install the
77+
> 📝 **Note**: `shapiq` uses the `requests` library, you might need to install the
6078
> certificates on your MacOS system ([more information](https://stackoverflow.com/a/53310545)).
6179
```sh
6280
/Applications/Python\ 3.x/Install\ Certificates.command
6381
```
64-
---
6582

66-
Finally, install the [pre-commit](https://pre-commit.com/) push hooks. This will run some code
67-
quality checks every time you push to GitHub.
83+
### 🛠️ Pre-Commit Hooks
84+
To ensure that the code quality is maintained, we use `pre-commit` hooks. You need to install the
85+
[pre-commit](https://pre-commit.com/) hooks. This will run some code quality checks every time
86+
you push to GitHub. You can view the checks in the `.pre-commit-config.yaml` file and the setup in
87+
the `pyproject.toml` file.
6888

6989
```sh
70-
pre-commit install --hook-type pre-push
90+
uv run pre-commit install
7191
```
7292

7393
If you want, you can optionally run `pre-commit` at any time as so:
7494

7595
```sh
76-
pre-commit run --all-files
77-
```
78-
79-
## 📝 Commit Messages
80-
81-
We do not enforce a strict commit message format, but we encourage you to follow good practices.
82-
We recommend to use action-words to automatically close issues or pull requests (example: `closes #123`).
83-
For example, start the commit message with a verb in the imperative mood, and keep the message short
84-
and concise. For example:
85-
86-
```
87-
add feature-xyz and closes #123
96+
uv run pre-commit run --all-files
8897
```
8998

9099
## 🛠️ Making Changes
@@ -102,7 +111,7 @@ To build the documentation on your end and to check if your changes are document
102111
need to install the documentation dependencies:
103112

104113
```sh
105-
pip install -e .[docs]
114+
uv sync --all-extras --dev --docs
106115
```
107116

108117
Then, you can build the documentation from the root of the repository with:
@@ -116,18 +125,18 @@ in your browser to see the rendered documentation.
116125

117126
### 🎯 Testing Changes
118127

119-
We use `pytest` for running unit tests and coverage. In the near future we will add `mypy` to the
120-
static type checking.
128+
We use `pytest` for running unit tests and coverage.
121129

122130
#### Unit Tests
123131

124132
Unit tests **absolutely need to pass**. Write unit tests for your changes. If you are adding a new
125133
feature, you need to add tests for the new feature. If you are fixing a bug it is a good idea to add
126134
a test that shows the bug and that your fix works.
127-
Unit tests are located in the `tests` directory. To run the tests, you can use the following command:
135+
Unit tests are located in the `tests` directory. To run the tests with `pytest`, you can use the
136+
following command and replace `n_jobs` with the number of jobs you want to run in parallel:
128137

129138
```sh
130-
pytest
139+
uv run pytest -n n_jobs
131140
```
132141

133142
#### Coverage
@@ -138,7 +147,7 @@ We use `pytest-cov` to measure the test coverage. To run the tests with coverage
138147
following command:
139148

140149
```sh
141-
pytest --cov=shapiq
150+
uv run pytest --cov=shapiq
142151
```
143152

144153
#### Static Type Checking and Code Quality
@@ -147,14 +156,5 @@ Currently, we do not have static type checking in place. We use `pre-commit` to
147156
checks. These checks **absolutely need to pass**. You can run the checks with the following command:
148157

149158
```sh
150-
pre-commit run --all-files
151-
```
152-
153-
In the near future we aim to use `mypy` for type checking. Once added this will also be part of the
154-
pre-commit pipeline and hence **absolutely need to pass**.
155-
156-
If you want, you can run `mypy` with the following command:
157-
158-
```sh
159-
mypy shapiq
159+
uv run pre-commit run --all-files
160160
```

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## Changelog
22

33
### Development
4+
5+
### v1.2.3 (2025-03-24)
6+
- substantially improves the runtime of all `Regression` approximators by a) a faster pre-computation of the regression matrices and b) a faster computation of the weighted least squares regression [#340](https://github.com/mmschlk/shapiq/issues/340)
47
- removes `sample_replacements` parameter from `MarginalImputer` and removes the DeprecationWarning for it
58
- adds a trivial computation to `TreeSHAP-IQ` for trees that use only one feature in the tree (this works for decision stumps or trees splitting on only one feature multiple times). In such trees, the computation is trivial as the whole effect of $\nu(N) - \nu(\emptyset)$ is all on the main effect of the single feature and there is no interaction effect. This expands on the fix in v1.2.1 [#286](https://github.com/mmschlk/shapiq/issues/286).
69
- fixes a bug with xgboost where feature names where trees that did not contain all features would lead `TreeExplainer` to fail
@@ -9,7 +12,6 @@
912
- updates default value of `TreeExplainer`'s `min_order` parameter from 1 to 0 to include the baseline value in the interaction values as per default
1013
- adds the `RegressionFBII` approximator to estimate Faithful Banzhaf interactions via least squares regression [#333](https://github.com/mmschlk/shapiq/pull/333). Additionally, FBII support was introduced in TabularExplainer and MonteCarlo-Approximator.
1114
- adds a `RandomGame` class as part of `shapiq.games.benchmark` which always returns a random vector of integers between 0 and 100.
12-
- substantially improves the runtime of all `Regression` approximators by a) a faster pre-computation of the regression matrices and b) a faster computation of the weighted least squares regression [#340](https://github.com/mmschlk/shapiq/issues/340)
1315

1416
### v1.2.2 (2025-03-11)
1517
- changes python support to 3.10-3.13 [#318](https://github.com/mmschlk/shapiq/pull/318)

docs/source/notebooks/basics_notebooks/custom_games.ipynb

+20-20
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
{
1313
"metadata": {
1414
"ExecuteTime": {
15-
"end_time": "2025-03-11T12:30:11.385995Z",
16-
"start_time": "2025-03-11T12:30:10.659924Z"
15+
"end_time": "2025-03-24T16:48:30.185677Z",
16+
"start_time": "2025-03-24T16:48:29.377002Z"
1717
}
1818
},
1919
"cell_type": "code",
@@ -28,7 +28,7 @@
2828
{
2929
"data": {
3030
"text/plain": [
31-
"'1.2.2'"
31+
"'1.2.3'"
3232
]
3333
},
3434
"execution_count": 1,
@@ -87,8 +87,8 @@
8787
{
8888
"metadata": {
8989
"ExecuteTime": {
90-
"end_time": "2025-03-11T12:30:11.393389Z",
91-
"start_time": "2025-03-11T12:30:11.388987Z"
90+
"end_time": "2025-03-24T16:48:30.191935Z",
91+
"start_time": "2025-03-24T16:48:30.188600Z"
9292
}
9393
},
9494
"cell_type": "code",
@@ -148,8 +148,8 @@
148148
{
149149
"metadata": {
150150
"ExecuteTime": {
151-
"end_time": "2025-03-11T12:30:11.456966Z",
152-
"start_time": "2025-03-11T12:30:11.454392Z"
151+
"end_time": "2025-03-24T16:48:30.259554Z",
152+
"start_time": "2025-03-24T16:48:30.257246Z"
153153
}
154154
},
155155
"cell_type": "code",
@@ -175,8 +175,8 @@
175175
{
176176
"metadata": {
177177
"ExecuteTime": {
178-
"end_time": "2025-03-11T12:30:11.466062Z",
179-
"start_time": "2025-03-11T12:30:11.463600Z"
178+
"end_time": "2025-03-24T16:48:30.265479Z",
179+
"start_time": "2025-03-24T16:48:30.263265Z"
180180
}
181181
},
182182
"cell_type": "code",
@@ -208,8 +208,8 @@
208208
{
209209
"metadata": {
210210
"ExecuteTime": {
211-
"end_time": "2025-03-11T12:30:11.476746Z",
212-
"start_time": "2025-03-11T12:30:11.474685Z"
211+
"end_time": "2025-03-24T16:48:30.271068Z",
212+
"start_time": "2025-03-24T16:48:30.269387Z"
213213
}
214214
},
215215
"cell_type": "code",
@@ -246,8 +246,8 @@
246246
{
247247
"metadata": {
248248
"ExecuteTime": {
249-
"end_time": "2025-03-11T12:30:11.503051Z",
250-
"start_time": "2025-03-11T12:30:11.487878Z"
249+
"end_time": "2025-03-24T16:48:30.299035Z",
250+
"start_time": "2025-03-24T16:48:30.284256Z"
251251
}
252252
},
253253
"cell_type": "code",
@@ -281,7 +281,7 @@
281281
"application/vnd.jupyter.widget-view+json": {
282282
"version_major": 2,
283283
"version_minor": 0,
284-
"model_id": "a4a24ae4e23b46f0bdea432aa1383e2f"
284+
"model_id": "aa634bdaebfc4d0898a693b66b3c1ee6"
285285
}
286286
},
287287
"metadata": {},
@@ -309,8 +309,8 @@
309309
{
310310
"metadata": {
311311
"ExecuteTime": {
312-
"end_time": "2025-03-11T12:30:11.514857Z",
313-
"start_time": "2025-03-11T12:30:11.508834Z"
312+
"end_time": "2025-03-24T16:48:30.308917Z",
313+
"start_time": "2025-03-24T16:48:30.304529Z"
314314
}
315315
},
316316
"cell_type": "code",
@@ -348,8 +348,8 @@
348348
{
349349
"metadata": {
350350
"ExecuteTime": {
351-
"end_time": "2025-03-11T12:30:11.526310Z",
352-
"start_time": "2025-03-11T12:30:11.522179Z"
351+
"end_time": "2025-03-24T16:48:30.322153Z",
352+
"start_time": "2025-03-24T16:48:30.318766Z"
353353
}
354354
},
355355
"cell_type": "code",
@@ -394,8 +394,8 @@
394394
{
395395
"metadata": {
396396
"ExecuteTime": {
397-
"end_time": "2025-03-11T12:30:11.534354Z",
398-
"start_time": "2025-03-11T12:30:11.532417Z"
397+
"end_time": "2025-03-24T16:48:30.331832Z",
398+
"start_time": "2025-03-24T16:48:30.330063Z"
399399
}
400400
},
401401
"cell_type": "code",

docs/source/notebooks/basics_notebooks/data_valuation.ipynb

+51-51
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)