Skip to content

365 potentially remove interactionvaluesvalues #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 31, 2025

Conversation

Advueu963
Copy link
Collaborator

@Advueu963 Advueu963 commented Jun 10, 2025

This pull request addresses #365 and #385 by changing InteractionValues.values and InteractionValues.interaction_lookup into properties. Introducing InteractionValues.interactions as the main part working with interactions.
We remove finalize_computed_interactions and incorporate it into the __init__ of InteractionValues.

Adding Logic into shapiq.Game:

  • Introduced the .coalition_values dictionary, mapping coalitions to their game values
  • Updated Loading and Saving to be based on .coalition_values.
  • Updated .value_storage and .coalition_lookup to be properties of the Game class

Removal of finalize_computed_interactions:

  • Updated all approximate methods in various approximator modules (owen.py, stratified.py, montecarlo/_base.py, permutation/sii.py, permutation/stii.py, permutation/sv.py, regression/_base.py, sparse/_base.py) to directly return InteractionValues with the target_index property included. This eliminates the need for the finalize_computed_interactions function. [1] [2] [3] [4] [5] [6] [7] [8]

  • Updated the explain_function in tabular.py and tree/explainer.py to replace calls to finalize_computed_interactions with direct instantiation of InteractionValues. [1] [2]

Simplification of imports:

These changes improve the maintainability of the code by reducing complexity and removing unnecessary dependencies.

@Advueu963 Advueu963 linked an issue Jun 10, 2025 that may be closed by this pull request
@Advueu963 Advueu963 self-assigned this Jun 10, 2025
@Advueu963 Advueu963 linked an issue Jun 10, 2025 that may be closed by this pull request
@mmschlk
Copy link
Owner

mmschlk commented Jun 18, 2025

This is amazing ... but we really gotta be careful integrating this haha 😂

@mmschlk
Copy link
Owner

mmschlk commented Jul 3, 2025

We could add this logic actually also to our game class ... I don't see if there is something which speaks against this.

@mmschlk mmschlk mentioned this pull request Jul 11, 2025
@Advueu963 Advueu963 force-pushed the 365-potentially-remove-interactionvaluesvalues branch from f8716d1 to 7a71c49 Compare July 28, 2025 14:45
@Advueu963 Advueu963 marked this pull request as ready for review July 30, 2025 12:25
@Advueu963 Advueu963 requested a review from mmschlk July 30, 2025 12:25
@Advueu963
Copy link
Collaborator Author

Advueu963 commented Jul 30, 2025

The coda quality error seems to be originate in tests/shapiq_games/test_tabular_local_xai.py, yet it pre-commit does not raise an issue locally, nor can I induce this change as pre-commit then changes it back

@mmschlk
Copy link
Owner

mmschlk commented Jul 30, 2025

The coda quality error seems to be originate in tests/shapiq_games/test_tabular_local_xai.py, yet it pre-commit does not raise an issue locally, nor can I induce this change as pre-commit then changes it back

I also do not get any local pre-commit changes. I will try to print the changes in the workflow and see what happens.

Copy link
Owner

@mmschlk mmschlk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hade one comment against defensive type checks. Otherwise this is good to go! 🫶🫡

@Advueu963 Advueu963 requested a review from mmschlk July 31, 2025 10:43
@mmschlk mmschlk merged commit 0a5e03a into main Jul 31, 2025
10 checks passed
@mmschlk mmschlk deleted the 365-potentially-remove-interactionvaluesvalues branch July 31, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redo Finalize Interaction Values Potentially remove InteractionValues.values
2 participants