Skip to content

Commit f129f19

Browse files
authored
Merge pull request #327 from appliedAI-Initiative/fix/285-test-grouped
Improvements to ValuationResult
2 parents f1fb525 + ccb0984 commit f129f19

File tree

14 files changed

+273
-100
lines changed

14 files changed

+273
-100
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
- Fixes in `ValuationResult`: bugs around data names, semantics of
6+
`empty()`, new method `zeros()` and normalised random values
7+
[PR #327](https://github.com/appliedAI-Initiative/pyDVL/pull/327)
58
- **New method**: Implements generalised semi-values for data valuation,
69
including Data Banzhaf and Beta Shapley, with configurable sampling strategies
710
[PR #319](https://github.com/appliedAI-Initiative/pyDVL/pull/319)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
deprecation>=2.0.6
1+
pyDeprecate>=0.3.2
22
numpy>=1.20
33
pandas>=1.3
44
scikit-learn

src/pydvl/value/least_core/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
from enum import Enum
2525
from typing import Optional
2626

27-
from deprecation import DeprecatedWarning
28-
2927
from pydvl.utils.utility import Utility
3028
from pydvl.value.least_core.montecarlo import *
3129
from pydvl.value.least_core.naive import *
@@ -84,11 +82,9 @@ def compute_least_core_values(
8482
# TODO: remove this before releasing version 0.6.0
8583
if kwargs:
8684
warnings.warn(
87-
DeprecatedWarning(
88-
"Passing solver options as kwargs",
89-
deprecated_in="0.5.1",
90-
removed_in="0.6.0",
91-
details="Use solver_options instead.",
85+
DeprecationWarning(
86+
"Passing solver options as kwargs was deprecated in 0.5.1, will "
87+
"be removed in 0.6.0. `Use solver_options` instead."
9288
)
9389
)
9490
if solver_options is None:

src/pydvl/value/least_core/common.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import cvxpy as cp
77
import numpy as np
8-
from deprecation import DeprecatedWarning
98
from numpy.typing import NDArray
109

1110
from pydvl.utils import MapReduceJob, ParallelConfig, Status, Utility
@@ -57,11 +56,10 @@ def lc_solve_problem(
5756
# TODO: remove this before releasing version 0.6.0
5857
if options:
5958
warnings.warn(
60-
DeprecatedWarning(
61-
"Passing solver options as kwargs",
62-
deprecated_in="0.5.1",
63-
removed_in="0.6.0",
64-
details="Use solver_options instead.",
59+
DeprecationWarning(
60+
"Passing solver options as kwargs was deprecated in "
61+
"0.5.1, will be removed in 0.6.0. `Use solver_options` "
62+
"instead."
6563
)
6664
)
6765
if solver_options is None:
@@ -256,10 +254,7 @@ def _solve_least_core_linear_program(
256254
e = cp.Variable()
257255

258256
objective = cp.Minimize(e)
259-
constraints = [
260-
A_eq @ x == b_eq,
261-
(A_lb @ x + e * np.ones(len(A_lb))) >= b_lb,
262-
]
257+
constraints = [A_eq @ x == b_eq, (A_lb @ x + e * np.ones(len(A_lb))) >= b_lb]
263258

264259
if non_negative_subsidy:
265260
constraints += [e >= 0]
@@ -333,10 +328,7 @@ def _solve_egalitarian_least_core_quadratic_program(
333328
x = cp.Variable(n_variables)
334329

335330
objective = cp.Minimize(cp.norm2(x))
336-
constraints = [
337-
A_eq @ x == b_eq,
338-
(A_lb @ x + subsidy * np.ones(len(A_lb))) >= b_lb,
339-
]
331+
constraints = [A_eq @ x == b_eq, (A_lb @ x + subsidy * np.ones(len(A_lb))) >= b_lb]
340332
problem = cp.Problem(objective, constraints)
341333

342334
try:

src/pydvl/value/least_core/montecarlo.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Iterable, Optional
44

55
import numpy as np
6-
from deprecation import DeprecatedWarning
76

87
from pydvl.utils.config import ParallelConfig
98
from pydvl.utils.numeric import random_powerset
@@ -17,10 +16,7 @@
1716
logger = logging.getLogger(__name__)
1817

1918

20-
__all__ = [
21-
"montecarlo_least_core",
22-
"mclc_prepare_problem",
23-
]
19+
__all__ = ["montecarlo_least_core", "mclc_prepare_problem"]
2420

2521

2622
def montecarlo_least_core(
@@ -68,11 +64,10 @@ def montecarlo_least_core(
6864
# TODO: remove this before releasing version 0.6.0
6965
if options:
7066
warnings.warn(
71-
DeprecatedWarning(
72-
"Passing solver options as kwargs",
73-
deprecated_in="0.5.1",
74-
removed_in="0.6.0",
75-
details="Use solver_options instead.",
67+
DeprecationWarning(
68+
"Passing solver options as kwargs was deprecated in "
69+
"0.5.1, will be removed in 0.6.0. `Use solver_options` "
70+
"instead."
7671
)
7772
)
7873
if solver_options is None:

src/pydvl/value/least_core/naive.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Optional
44

55
import numpy as np
6-
from deprecation import DeprecatedWarning
76

87
from pydvl.utils import Utility, maybe_progress, powerset
98
from pydvl.value.least_core.common import LeastCoreProblem, lc_solve_problem
@@ -61,11 +60,10 @@ def exact_least_core(
6160
# TODO: remove this before releasing version 0.6.0
6261
if options:
6362
warnings.warn(
64-
DeprecatedWarning(
65-
"Passing solver options as kwargs",
66-
deprecated_in="0.5.1",
67-
removed_in="0.6.0",
68-
details="Use solver_options instead.",
63+
DeprecationWarning(
64+
"Passing solver options as kwargs was deprecated in "
65+
"0.5.1, will "
66+
"be removed in 0.6.0. `Use solver_options` instead."
6967
)
7068
)
7169
if solver_options is None:

0 commit comments

Comments
 (0)