Skip to content

Commit

Permalink
ran black
Browse files Browse the repository at this point in the history
  • Loading branch information
mmschlk committed Feb 14, 2024
1 parent 95d5688 commit 596acd3
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions shapiq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""shapiq is a library creating explanations for machine learning models based on
the well established Shapley value and its generalization to interaction.
"""

from __version__ import __version__

# approximator classes
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the approximators to estimate the Shapley interaction values."""

from .k_sii import convert_ksii_into_one_dimension, transforms_sii_to_ksii
from .permutation.sii import PermutationSamplingSII
from .permutation.sti import PermutationSamplingSTI
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the base approximator classes for the shapiq package."""

from abc import ABC, abstractmethod
from typing import Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/k_sii.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module provides the functionality to transform SII values into k-SII values."""

from typing import Optional, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/permutation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains all permutation-based sampling algorithms to estimate SII/nSII and STI."""

from .sii import PermutationSamplingSII
from .sti import PermutationSamplingSTI

Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/permutation/sii.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module implements the Permutation Sampling approximator for the SII (and k-SII) index."""

from typing import Callable, Optional

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/permutation/sti.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the permutation sampling algorithms to estimate STI scores."""

import warnings
from typing import Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/regression/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains the regression-based approximators to estimate Shapley interaction values.
"""

from .fsi import RegressionFSI
from .sii import RegressionSII
from .sv import KernelSHAP
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/regression/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the regression algorithms to estimate FSI and SII scores."""

from typing import Callable, Optional

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/regression/fsi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression with Faithful Shapley Interaction (FSI) index approximation."""

from typing import Optional

from ..k_sii import KShapleyMixin
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/regression/sii.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Regression with Shapley interaction index (SII) approximation."""

from typing import Optional

from ..k_sii import KShapleyMixin
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/regression/sv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains the KernelSHAP regression approximator for estimating the SV.
Regression with Faithful Shapley Interaction (FSI) index approximation."""

from typing import Optional

from ._base import Regression
Expand Down
1 change: 1 addition & 0 deletions shapiq/approximator/shapiq/shapiq.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the shapiq estimator."""

import math
from typing import Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions shapiq/datasets/_all.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains functions to load datasets."""

import os

import pandas as pd
Expand Down
1 change: 0 additions & 1 deletion shapiq/explainer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""This module contains the explainer for the shapiq package."""


from .interaction import InteractionExplainer
from .tree import TreeExplainer

Expand Down
1 change: 1 addition & 0 deletions shapiq/explainer/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the base explainer classes for the shapiq package."""

from abc import ABC, abstractmethod
from typing import Callable

Expand Down
1 change: 1 addition & 0 deletions shapiq/explainer/imputer/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for imputers."""

from abc import abstractmethod
from typing import Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions shapiq/explainer/imputer/marginal_imputer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the marginal imputer for the shapiq package."""

from typing import Callable, Optional

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions shapiq/explainer/interaction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains the interaction explainer for the shapiq package. This is the main interface
for users of the shapiq package."""

from typing import Callable, Optional, Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions shapiq/explainer/tree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains the TreeSHAP-IQ explainer for computing exact any order Shapley interactions
for trees and tree ensembles."""

import numpy as np
from approximator._interaction_values import InteractionValues
from explainer._base import Explainer
Expand Down
1 change: 1 addition & 0 deletions shapiq/games/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains sample game functions for the shapiq package."""

from games.dummy import DummyGame

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion shapiq/games/dummy.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""This module contains the DummyGame class. The DummyGame class is mainly used for testing
purposes. It returns the size of the coalition divided by the number of players plus an additional
interaction term."""

from typing import Union

import numpy as np


class DummyGame:

"""Dummy game for testing purposes. When called, it returns the size of the coalition divided by
the number of players plus an additional interaction term.
Expand Down
1 change: 1 addition & 0 deletions shapiq/plot/_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the configuration for the shapiq visualizations."""

from colour import Color

__all__ = [
Expand Down
1 change: 1 addition & 0 deletions shapiq/plot/network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains the network plots for the shapiq package."""

import copy
import math
from typing import Any, Optional, Union
Expand Down
9 changes: 6 additions & 3 deletions shapiq/plot/stacked_bar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains functions to plot the n_sii stacked bar charts."""

__all__ = ["stacked_bar_plot"]

from copy import deepcopy
Expand Down Expand Up @@ -124,9 +125,11 @@ def stacked_bar_plot(

# set title and labels if not provided

axis.set_title(
f"n-SII values up to order ${n_sii_max_order}$"
) if title is None else axis.set_title(title)
(
axis.set_title(f"n-SII values up to order ${n_sii_max_order}$")
if title is None
else axis.set_title(title)
)

axis.set_xlabel("features") if xlabel is None else axis.set_xlabel(xlabel)
axis.set_ylabel("n-SII values") if ylabel is None else axis.set_ylabel(ylabel)
Expand Down
1 change: 1 addition & 0 deletions shapiq/utils/sets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module contains utility functions for dealing with sets, coalitions and game theory."""

import copy
from collections.abc import Iterable
from itertools import chain, combinations
Expand Down
1 change: 1 addition & 0 deletions tests/tests_approximators/test_approximator_shapiq.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This test module contains all tests regarding the shapiq approximator."""

from copy import copy, deepcopy

import numpy as np
Expand Down

0 comments on commit 596acd3

Please sign in to comment.