Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ We have begun the process of modularizing the `shapiq` package by splitting it i

This restructuring aims to improve maintainability and development scalability. The core `shapiq` package will continue to receive the majority of updates and enhancements, and keeping it streamlined ensures better focus and usability. Meanwhile, separating games and benchmarking functionality allows these components to evolve more independently while maintaining compatibility through clearly defined dependencies.

### Removed Features
- removes the ability to load `InteractionValues` from pickle files. This is now deprecated and will be removed in the next release. Use `InteractionValues.save(..., as_json=True)` to save interaction values as JSON files instead. [#413](https://github.com/mmschlk/shapiq/issues/413)
### Maintenance and Development
- refactored the `shapiq.Games` and `shapiq.InteractionValues` API by adding an interactions and game_values dictionary as the main data structure to store the interaction scores and game values. This allows for more efficient storage and retrieval of interaction values and game values, as well as easier manipulation of the data. [#419](https://github.com/mmschlk/shapiq/pull/419)
- addition and subtraction of InteractionValues objects (via `shapiq.InteractionValues.__add__`) now also works for different indices, which will raise a warning and will return a new InteractionValues object with the index set of the first. [#422](https://github.com/mmschlk/shapiq/pull/422)

### Docs
- added an example notebook for `InteractionValues`, highlighting *Initialisation*, *Modification*, *Visualization* and *Save and Loading*.
- added an example notebook for `InteractionValues`, highlighting *Initialization*, *Modification*, *Visualization* and *Save and Loading*.

### Bugfixes
- fixes a bug where RegressionFBII approximator was throwing an error when the index was `'BV'` or `'FBII'`.[#420](https://github.com/mmschlk/shapiq/pull/420)

### Removed Features
- removes the ability to load `InteractionValues` from pickle files. This is now deprecated and will be removed in the next release. Use `InteractionValues.save(..., as_json=True)` to save interaction values as JSON files instead. [#413](https://github.com/mmschlk/shapiq/issues/413)


## v1.3.1 (2025-07-11)

### New Features
Expand Down
6 changes: 3 additions & 3 deletions src/shapiq/interaction_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ def __add__(self, other: InteractionValues | float) -> InteractionValues:
if isinstance(other, InteractionValues):
if self.index != other.index: # different indices
msg = (
f"Cannot add InteractionValues with different indices {self.index} and "
f"{other.index}."
f"The indices of the InteractionValues objects are different: "
f"{self.index} != {other.index}. Addition might not be meaningful."
)
raise ValueError(msg)
warn(msg, stacklevel=2)
Comment thread
mmschlk marked this conversation as resolved.
if (
self.interaction_lookup != other.interaction_lookup
or self.n_players != other.n_players
Expand Down
6 changes: 4 additions & 2 deletions tests/shapiq/tests_unit/test_interaction_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ def test_add():
interaction_lookup=interaction_lookup,
baseline_value=0.0,
)
with pytest.raises(ValueError):
interaction_values_first + interaction_values_second
with pytest.warns(match="The indices of the InteractionValues objects are different:"):
result = interaction_values_first + interaction_values_second
assert result.index == interaction_values_first.index
assert result.index != interaction_values_second.index

# test adding InteractionValues with different interactions
n_players_second = n + 1
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading