diff --git a/CHANGELOG.md b/CHANGELOG.md index d548ff43d..c990ca1d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ randomness. `compute_beta_shapley_semivalues`, `compute_shapley_semivalues` and `compute_generic_semivalues`. [PR #428](https://github.com/aai-institute/pyDVL/pull/428) +- Added classwise Shapley as proposed by (Schoch et al. 2021) + [https://arxiv.org/abs/2211.06800] + [PR #338](https://github.com/aai-institute/pyDVL/pull/338) ### Changed diff --git a/src/pydvl/utils/numeric.py b/src/pydvl/utils/numeric.py index dd22dad9a..84487614f 100644 --- a/src/pydvl/utils/numeric.py +++ b/src/pydvl/utils/numeric.py @@ -4,10 +4,6 @@ """ from __future__ import annotations -import logging -import os -import random -import time from itertools import chain, combinations from typing import ( Collection, @@ -17,8 +13,6 @@ Optional, Tuple, TypeVar, - Union, - cast, overload, ) @@ -39,10 +33,6 @@ "top_k_value_accuracy", ] - -logger = logging.getLogger(__name__) - - T = TypeVar("T", bound=np.generic) @@ -184,7 +174,8 @@ def random_powerset_label_min( if min_elements_per_label < 0: raise ValueError( - f"Parameter min_elements={min_elements_per_label} needs to be bigger or equal to 0." + f"Parameter min_elements={min_elements_per_label} needs to be bigger or " + f"equal to 0." ) rng = np.random.default_rng(seed) diff --git a/src/pydvl/value/shapley/classwise.py b/src/pydvl/value/shapley/classwise.py index 1470ca385..cfc6226d3 100644 --- a/src/pydvl/value/shapley/classwise.py +++ b/src/pydvl/value/shapley/classwise.py @@ -71,17 +71,19 @@ from numpy.typing import NDArray from tqdm import tqdm +from pydvl.parallel import ( + ParallelConfig, + effective_n_jobs, + init_executor, + init_parallel_backend, +) from pydvl.utils import ( Dataset, - ParallelConfig, Scorer, Seed, SupervisedModel, Utility, - effective_n_jobs, ensure_seed_sequence, - init_executor, - init_parallel_backend, random_powerset_label_min, ) from pydvl.value.result import ValuationResult