shapiq icon indicating copy to clipboard operation
shapiq copied to clipboard

Implement LeverageSHAP approximator

Open FabianK-Dev opened this issue 6 months ago • 3 comments

Motivation and Context

In this PR we added the implementation of the LeverageSHAP approximator, based on the paper by Musco & Witter (2024). We built (1) a custom sampler for leverage score sampling (uniform size + paired sampling) (2) implemented the regression solver using the row-centering trick (Lemma 3.1) and (3) added different test cases. We originally opened a PR in our fork (https://github.com/FabianK-Dev/shapiq/pull/1) which I closed now and I am reopening here.

A few disclaimers / important notes:

    1. We already commited our summary src/shapiq/approximator/regression/our_impl_progress.md (as requsted in the project description) but this file is stil work-in-progress and not really ready for review, yet.
    1. There are still more unittests to come: I estimate we only covered around 50 % of unittests.
    1. We will improve existing docstrings and add more later on.

Public API Changes

  • [ ] No Public API changes
  • [x] Yes, Public API changes (Details below)

Details: Added LeverageSHAP class to shapiq.approximator.regression.


How Has This Been Tested?

We added many unittests to cover the following things:

  • Budget constraints, exact recovery on additive games and deterministic behavior.
  • Tested with large n to verify the IS weight cancellation prevents float overflows.
  • Tested with highly skewed interaction games to ensure the lstsq solver maintains the efficiency axiom on ill-conditioned matrices.
  • Verified the reproducibility requirement by testing that the mean L2 error drops significantly when increasing the budget on a synthetic game.

You can run all new unittests using: uv run pytest tests/shapiq/tests_unit/tests_approximators/test_approximator_leverageshap.py

Tests are passing:

uv run pytest tests/shapiq/tests_unit/tests_approximators/test_approximator_leverageshap.py
warning: `VIRTUAL_ENV=/home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/.venv` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
====================================================================================== test session starts ======================================================================================
platform linux -- Python 3.13.5, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq
configfile: pyproject.toml
plugins: xdist-3.8.0, cov-7.0.0, anyio-4.12.1
collected 15 items                                                                                                                                                                              

tests/shapiq/tests_unit/tests_approximators/test_approximator_leverageshap.py ...............                                                                                             [100%]

====================================================================================== 15 passed in 0.20s =======================================================================================

Checklist

We haven't completed all points on the checklist yet, as this is still an early PR where we ask for feedback but don't plan to merge it into the upstream repository, yet.

  • [x] The changes have been tested locally.
  • [ ] ~~Documentation has been updated (if the public API or usage changes).~~
  • [ ] ~~An entry has been added to CHANGELOG.md (if relevant for users).~~
  • [x] The code follows the project's style guidelines.
  • [x] I have considered the impact of these changes on the public API.

FabianK-Dev avatar May 22 '26 13:05 FabianK-Dev

Finally all tests pass again after:

  • Refactoring leverageshap.py to move its _solve() method into the base regression class in 274207ee79eebdc19b80a1e9f8004445d8dfcb28 and 66c4e6c546f12aaae9256167cc02a86045d80302
  • Updating tests in 433fb7ab82326dbc8c73c9bae0d09a9e1ade9dc0 to test a list of pre-defined seeds to prevent and accidental overfitting on seeds and fix tests accordingly in 348db3beecd6e7f894aa8fe99106250818b9a8f2
========================================== 1270 passed, 166 skipped, 124 xfailed, 32 xpassed, 5181 warnings in 956.40s (0:15:56) ==========================================

real    16m2,138s
user    119m51,705s
sys     0m37,665s

FabianK-Dev avatar May 30 '26 23:05 FabianK-Dev

Disclaimer: I just rebased and removed @42logos's benchmark merge commits from this branch so that they don't need to be reviewed twice. I also removed the WIP notebook DISCUSSION.md file and WIP 1-page-summary file (both files are not ready for review, yet and are part of task 4) and moved those commits to a new draft PR: https://github.com/mmschlk/shapiq/pull/542

FabianK-Dev avatar Jun 08 '26 12:06 FabianK-Dev

Dear @mmschlk, @pwhofman, this PR is now ready for review. The PR contains the following implementation/changes:

Task 1: Implement the approximators

  • We implemented Algorithm 1 from the Musco & Witter (2024) paper
  • This includes: the binary search for the oversampling parameter c, the paired Bernoulli sampling to reduce variance, and the row/target centering trick (Lemma 3.1) to translate the constrained efficiency problem into an unconstrained WLS problem.
  • We completely removed the try/except block in solve_regression.
  • Instead, we implemented a deterministic rank check (and a check for NaN/inf values caused by extreme weights).
  • If the Gram matrix is rank-deficient, we route it directly into the SVD solver (np.linalg.lstsq).
  • This prevents the LinAlgError crashes we saw during edge-case testing and makes the base class much more stable overall.

Task 2: Correctness tests

  • We added ~600 lines of unit tests to be absolutely sure that the implementation works as expected:
  • We also used @pytest.mark.parametrize("seed", DIVERSE_SEEDS) on any test cases with fixed seeds to ensure the implementation works as expected across different random paths, not just for seed=42.
  • All 1,300+ tests in the repo are green (or only xFail, i.e. no failures occur):

Task 3: Reproduce the paper experiments

To prove that our implementation behaves as expected, we added two notebooks (reproduce_leverageshap_ml.ipynb and reproduce_leverageshap_soum.ipynb) along with the Communities and Crime dataset. They reproduce the main convergence plots from the paper and compare our native LeverageSHAP against ExactComputer.

Looking forward to your feedback! Please let us know if you want us to adjust anything.

$ git status
On branch leverageSHAP
Your branch is up to date with 'origin/leverageSHAP'.

nothing to commit, working tree clean
$ time uv run pytest -n auto
      Built shapiq @ file:///home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq
Uninstalled 1 package in 0.45ms
░░░░░░░░░░░░░░░░░░░░ [0/1] Installing wheels...                                                                                                                                                                                       warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 1 package in 1ms
======================================================================================================== test session starts =========================================================================================================
platform linux -- Python 3.13.5, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq
configfile: pyproject.toml
testpaths: tests/shapiq, tests/shapiq_games
plugins: xdist-3.8.0, cov-7.0.0, anyio-4.12.1
6 workers [1371 items]  
............ssss.............................................................................................................................................................................................................. [ 16%]
......................................................................................................................................................x...xxxx.....x.xx....................................................... [ 32%]
x....xx...x....x..x....x..x....x..x....x..x....x......................................xx.x......x.x..x..........xx....x........xx................................................x..x.................................xx...... [ 48%]
....................................xx.........xx.....xx....................................................................x.x.................s..........s..........s....................................................... [ 64%]
............................x................................................................................................................................................................................................. [ 80%]
.......................................................................................s.....................................................................................................................s.......sss..x..x [ 97%]
..........x....x..x....x..x....x..x....                                                                                                                                                                                        [100%]
========================================================================================================== warnings summary ==========================================================================================================
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:122: PytestUnknownMarkWarning: Unknown pytest.mark.integration - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.integration

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_integration_tests/test_explainer_california_housing.py:142: PytestUnknownMarkWarning: Unknown pytest.mark.integration - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.integration

tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:13: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_tabpfn.py:98: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:29: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:54: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:69: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py:84: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:525: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:572: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_bugfix.py:625: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py:515: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_validate.py:37: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:14: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:48: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_imputer/test_tabpfn_imputer.py:79: PytestUnknownMarkWarning: Unknown pytest.mark.external_libraries - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.external_libraries

tests/shapiq/tests_unit/tests_approximators/test_approximator_base_sparse.py: 132 warnings
tests/shapiq/tests_unit/tests_approximators/test_approximator_spex.py: 169 warnings
tests/shapiq/tests_unit/tests_explainer/test_configuration.py: 21 warnings
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py: 12 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/.venv/lib/python3.13/site-packages/galois/_codes/_bch.py:209: DeprecationWarning: galois.Field() is deprecated and will be removed in 0.5.0; use galois.GF() instead.
    extension_field = Field(q**m, irreducible_poly=irreducible_poly)

tests/shapiq/tests_unit/tests_approximators/test_approximator_kernelshap.py: 1 warning
tests/shapiq/tests_unit/tests_approximators/test_approximator_regression_fsi.py: 1 warning
tests/shapiq/tests_unit/tests_explainer/test_explainer_models.py: 1 warning
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py: 18 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/regression/base.py:159: UserWarning: Not all budget is required due to the border-trick.
    self._sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_approximator_permutation_sii.py::test_approximate[7-2-True-500-None-k-SII]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/interaction_values.py:1226: UserWarning: The base interaction values have a minimum order greater than 1. Aggregation may not be meaningful.
    interactions, index, min_order = aggregate_base_attributions(

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[3-STII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tree_explainer[1-SII]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[6-FBII-Explainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_agnostic_explainer[5-BV]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExactComputer::test_with_recompute[1-SV]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_integration_tests/compute_test_explanations.py:17: DeprecationWarning: This collection of games is deprecated and will be removed in a future version.
    from shapiq_games.benchmark.treeshapiq_xai import TreeSHAPIQXAI

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[3-STII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tree_explainer[1-SII]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tree_explainer[1-SII]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[6-FBII-Explainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_agnostic_explainer[5-BV]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExactComputer::test_with_recompute[1-SV]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-SII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-SII-Explainer]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer.py::test_against_shap_implementation
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=SII. SII generalizes 'SV'. Setting index to 'SV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tree_explainer[1-k-SII]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-k-SII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-k-SII-Explainer]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=k-SII. k-SII generalizes 'SV'. Setting index to 'SV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_unit/tests_approximators/test_approximator_proxyspex.py::test_approximate[10-interactions0-1000]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/proxy/proxyspex.py:128: UserWarning: Sampling might be inefficient (stalls) due to the sampling budget being close to the total number of coalitions to be sampled.
    self._sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_approximator_proxyspex.py: 80 warnings
tests/shapiq/tests_unit/tests_explainer/test_explainer_models.py: 103 warnings
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py: 1 warning
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py: 1792 warnings
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer.py: 1 warning
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py: 2 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/.venv/lib/python3.13/site-packages/sklearn/utils/validation.py:2691: UserWarning: X does not have valid feature names, but LGBMRegressor was fitted with feature names
    warnings.warn(

tests/shapiq/tests_unit/tests_approximators/test_approximator_proxyspex.py::test_approximate[7-interactions1-800]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/proxy/proxyspex.py:128: UserWarning: Not all budget is required due to the border-trick.
    self._sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_approximator_regression_fbi.py::test_extreme_weight_initialisation
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/sampling.py:228: RuntimeWarning: divide by zero encountered in divide
    return self.coalitions_counter / (self.coalitions_probability * n_coalitions_total_samples)

tests/shapiq/tests_unit/tests_approximators/test_approximator_regression_fbi.py::test_extreme_weight_initialisation
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/regression/base.py:612: RuntimeWarning: invalid value encountered in multiply
    regression_weights *= sampling_adjustment_weights

tests/shapiq/tests_unit/tests_approximators/test_approximator_shapiq.py::test_approximate_sii[7-2-False-300]
tests/shapiq/tests_unit/tests_approximators/test_approximator_svarm.py::test_approximate_sii[7-300]
tests/shapiq/tests_unit/tests_approximators/test_approximator_svarmiq.py::test_approximate_sii[7-2-False-300]
tests/shapiq/tests_unit/tests_game_theory/test_aggregation.py::test_k_sii_estimation[sii_approximator1-ksii_approximator1]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/approximator/montecarlo/base.py:110: UserWarning: Not all budget is required due to the border-trick.
    self._sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_approximator_spex.py::test_approximate[7-interaction1-800]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/.venv/lib/python3.13/site-packages/sparse_transform/qsft/utils/reconstruct.py:147: RuntimeWarning: divide by zero encountered in divide
    res = np.real(U_slice/U_slice[0])[1:]

tests/shapiq/tests_unit/tests_approximators/test_approximator_spex.py::test_approximate[7-interaction1-800]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/.venv/lib/python3.13/site-packages/sparse_transform/qsft/utils/reconstruct.py:147: RuntimeWarning: invalid value encountered in divide
    res = np.real(U_slice/U_slice[0])[1:]

tests/shapiq/tests_unit/tests_approximators/test_sampling.py::test_basic_functionality[100-5]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_approximators/test_sampling.py:32: UserWarning: Not all budget is required due to the border-trick.
    sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_sampling.py::test_basic_functionality[100-5]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_approximators/test_sampling.py:59: UserWarning: Not all budget is required due to the border-trick.
    sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_sampling.py::test_sampling
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_approximators/test_sampling.py:122: UserWarning: Not all budget is required due to the border-trick.
    sampler.sample(budget)

tests/shapiq/tests_unit/tests_approximators/test_sampling.py::test_sampling
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_approximators/test_sampling.py:144: UserWarning: Not all budget is required due to the border-trick.
    sampler_scaled.sample(budget)

tests/shapiq/tests_unit/tests_explainer/test_explainer_models.py: 205 warnings
tests/shapiq/tests_unit/tests_explainer/test_explainer_utils.py: 1 warning
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py: 1792 warnings
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_tree_explainer_conversion.py: 2 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/.venv/lib/python3.13/site-packages/sklearn/utils/validation.py:2691: UserWarning: X does not have valid feature names, but LGBMClassifier was fitted with feature names
    warnings.warn(

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-STII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-STII-Explainer]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=STII. STII generalizes 'SV'. Setting index to 'SV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-FSII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-FSII-Explainer]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=FSII. FSII generalizes 'SV'. Setting index to 'SV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-BII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-BII-Explainer]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=BII. BII generalizes 'BV'. Setting index to 'BV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-FBII-TabularExplainer]
tests/shapiq/tests_integration_tests/test_explainer_california_housing.py::TestCaliforniaHousingExplainers::test_tabular_explainer[1-FBII-Explainer]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:92: UserWarning: Mismatch between max_order=1 and index=FBII. FBII generalizes 'BV'. Setting index to 'BV'.
    validated_index = validate_index(index, max_order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py: 15 warnings
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py: 12 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:314: RuntimeWarning: invalid value encountered in scalar divide
    weight = interaction_size / (

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_rf_reg_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_rf_reg_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -18.842508284983076.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_dt_reg_index_order[CHII-2]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -13.493638183596156.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_dt_clas_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_dt_clas_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 0.2961637931034483.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_rf_clas_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_rf_clas_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 0.3210565474238748.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_xgb_clas_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_xgb_clas_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -0.10565032064914703.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[2-spex]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[2-montecarlo]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[2-svarm]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[2-permutation]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[2-regression]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:93: UserWarning: Mismatch between max_order=2 and index=SV. Setting max_order=1. 
    validated_max_order = validate_max_order(validated_index, max_order)

tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[3-spex]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[3-montecarlo]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[3-svarm]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[3-permutation]
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_init_params_approx_params[3-regression]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/explainer/validation.py:93: UserWarning: Mismatch between max_order=3 and index=SV. Setting max_order=1. 
    validated_max_order = validate_max_order(validated_index, max_order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_xgb_reg_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_xgb_reg_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -8.598283767700195.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/test_interaction_values.py::test_initialization[something-5-1-2-100-False]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/test_interaction_values.py:76: UserWarning: Index `something` is not a valid interaction index. Valid indices are: SII, BII, CHII, Co-Moebius, SGV, BGV, CHGV, IGV, EGV, k-SII, STII, FSII, kADD-SHAP, FBII, SV, BV, JointSV, Moebius, ELC.
    interaction_values_2 = InteractionValues(

tests/shapiq/tests_unit/test_interaction_values.py::test_initialization[something-5-1-2-100-False]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/interaction_values.py:466: UserWarning: Index `something` is not a valid interaction index. Valid indices are: SII, BII, CHII, Co-Moebius, SGV, BGV, CHGV, IGV, EGV, k-SII, STII, FSII, kADD-SHAP, FBII, SV, BV, JointSV, Moebius, ELC.
    return InteractionValues(

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_lgbm_clas_index_order[CHII-3]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_lgbm_clas_index_order[CHII-2]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -1.1165669997122092.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_lgbm_reg_index_order[CHII-2]
tests/shapiq/tests_unit/tests_explainer/tests_tree_explainer/test_correct_calculation.py::test_correct_calculation_lgbm_reg_index_order[CHII-3]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -4.446528365458552.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_call[CHII-2]
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_permutation_symmetry[CHII-2]
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_warning_cii
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_player_symmetry[CHII-2]
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_null_player[CHII-2]
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_no_artefact_interaction[CHII-2]
tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 0.0.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_games/test_base_game.py::test_abstract_game
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:195: RuntimeWarning: Normalization value is set to `None`. No normalization value was provided at initialization. Make sure to set the normalization value before calling the game.
    game = get_concrete_class(Game)(n_players=n)

tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_init_from_saved_game[.json]
tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_init_from_saved_game[.npz]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:253: RuntimeWarning: Normalization value is set to `None`. No normalization value was provided at initialization. Make sure to set the normalization value before calling the game.
    loaded_game = Game(n_players=cooking_game_pre_computed.n_players)

tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_game_npz
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:269: RuntimeWarning: Normalization value is set to `None`. No normalization value was provided at initialization. Make sure to set the normalization value before calling the game.
    loaded_game = Game(n_players=cooking_game_pre_computed.n_players)

tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.json]
tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.npz]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:298: UserWarning: The game has not been precomputed yet. Saving the game may be slow.
    game.save_values(path)

tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.json]
tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.npz]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:300: RuntimeWarning: Normalization value is set to `None`. No normalization value was provided at initialization. Make sure to set the normalization value before calling the game.
    game_loaded = Game(n_players=4)

tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.json]
tests/shapiq/tests_unit/tests_games/test_base_game.py::TestSavingGames::test_save_and_load_with_normalization[.npz]
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_games/test_base_game.py:309: RuntimeWarning: Normalization value is set to `None`. No normalization value was provided at initialization. Make sure to set the normalization value before calling the game.
    game_loaded = Game(n_players=4)

tests/shapiq/tests_unit/tests_imputer/test_baseline_imputer.py::test_baseline_init_background
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/imputer/baseline_imputer.py:90: UserWarning: Feature 2 is not numerical. Adding it to categorical features.
    self.init_background(self.data)

tests/shapiq/tests_unit/tests_imputer/test_marginal_imputer.py::test_marginal_imputer_init
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_against_shap_linear
tests/shapiq/tests_unit/tests_explainer/test_explainer_tabular.py::test_explain_X_progressbar
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/imputer/marginal_imputer.py:109: UserWarning: The sample size is larger than the number of data points in the background set. Reducing the sample size to the number of background samples.
    self.init_background(self.data)

tests/shapiq/tests_unit/tests_imputer/test_conditional_imputer.py::test_conditional_imputer_init
tests/shapiq/tests_unit/tests_imputer/test_conditional_imputer.py::test_conditional_imputer_value_function
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/imputer/generative_conditional_imputer.py:92: UserWarning: `conditional_budget` is higher than `2**n_features`; setting `conditional_budget = 2**n_features`
    self.init_background(data=data)

tests/shapiq/tests_unit/tests_game_theory/test_core.py: 20 warnings
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/tests/shapiq/tests_unit/tests_game_theory/test_core.py:32: UserWarning: The egalitarian least core is only defined for normalized games.Thus the resulting vector will undercut efficiency by the value of the empty set.To suppress warnings normalize the game to have baseline_value == 0.
    egalitarian_vector, subsidy = egalitarian_least_core(

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 1.5686683081674297.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 0.09221581544840562.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -0.2336216158860971.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -0.6711346984749096.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -1.2755535391569994.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 1.3116067341268958.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value 2.1594130793614132.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -3.094488575685401.
    base_interaction = self.base_interaction(index, order)

tests/shapiq/tests_unit/tests_game_theory/test_exact_computer.py::test_exact_computer_on_soum
  /home/fabian/Dokumente/Uni/LMU/Master/Semester2/Toolbox/shapiq/src/shapiq/game_theory/exact.py:975: UserWarning: CHII is not defined for the empty set. Setting to the baseline value -0.07115305464676114.
    base_interaction = self.base_interaction(index, order)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================== 1305 passed, 12 skipped, 54 xfailed, 4576 warnings in 134.74s (0:02:14) ===============================================================================

real    2m31,933s
user    11m8,244s
sys     0m17,313s

FabianK-Dev avatar Jun 08 '26 12:06 FabianK-Dev

Overall a very nice implementation and nice safeguards implemented for large n. Yet I think we can (a) get rid of the log procedure you introduced, as the _find_c is already the bottleneck for large n, if I see this correctly^^.

Also I have left a comment on how the CoalitionSampler can be used, to produce very similar sampling procedures. See Figure 9 of the Leverageshape paper, of where the differences lie. The CoalitionSampler in our code is somewhat doing without BernoulliSampling.

Dear @Advueu963, thank you very much for the feedback! I will implement your suggestions asap.

FabianK-Dev avatar Jun 14 '26 20:06 FabianK-Dev

Dead @mmschlk, I refactored the solve_regression() method in src/shapiq/approximator/regression/base.py as discussed in our meeting and removed a (now outdated/unused) old unit test in e70f9d621c0b89d690156f9c39177150317bf6e6 and solved all remaining ruff style warnings in 67d05fc6697a29405c3e1c4fc084707aba72225d.

The method is now cleaned up, more readable introduces the "safe" try-except code block as well as the use_svd parameter that will be exclusively used by LeverageSHAP. I removed the unsafe code blocks that would return np.nan. It now throws errors instead.

Could you please review the changes? Thank you.

I've also run the following commands locally to ensure all code quality checks (pre-commit), unit-tests and coverage pass (the same commands like in the GitHub CI pipeline):

uv sync --group lint --all-extras
uv run pre-commit run --all-files --show-diff-on-failure

uv sync --all-extras
uv run pytest "tests/shapiq" --cov=shapiq --cov-report=term -n logical

uv sync --no-dev --all-extras --group all_ml
uv run --no-sync python -c "import shapiq; print('✅ shapiq imported successfully')"
uv run --no-sync python -c "import shapiq_games; print('✅ shapiq_games imported successfully')"

I've you're okay with the changes, please feel free to re-run the workflow in Github.

FabianK-Dev avatar Jun 18 '26 15:06 FabianK-Dev

Codecov Report

:x: Patch coverage is 95.65217% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/shapiq/approximator/regression/leverageshap.py 95.10% 7 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Jun 30 '26 08:06 codecov[bot]

Thanks for running the CI. I see that the documentation is not building correctly and that some lines are still missing coverage. I'll have a look at it ASAP.

FabianK-Dev avatar Jun 30 '26 09:06 FabianK-Dev