Skip to content

Commit f007ce8

Browse files
committed
Cosmetic
1 parent 317f8b1 commit f007ce8

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Changelog
22

3-
## 0.7.0 - 📚 Documentation overhaul, new methods and bug fixes 💥
3+
## 0.7.0 - 📚🆕 Documentation and IF overhaul, new methods and bug fixes 💥🐞
44

55
This is our first β release! We have worked hard to deliver improvements across
6-
the board, with a focus on documentation and usability.
6+
the board, with a focus on documentation and usability. We have also reworked
7+
the internals of the `influence` module, improved parallelism and handling of
8+
randomness.
79

810
### Added
911

@@ -19,6 +21,7 @@ the board, with a focus on documentation and usability.
1921
[PR #396](https://github.com/aai-institute/pyDVL/pull/396)
2022

2123
### Changed
24+
2225
- Replaced sphinx with mkdocs for documentation. Major overhaul of documentation
2326
[PR #352](https://github.com/aai-institute/pyDVL/pull/352)
2427
- Made ray an optional dependency, relying on joblib as default parallel backend

src/pydvl/utils/functional.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def _accept_additional_argument(*args, fun: Callable, arg: str, **kwargs):
3333

3434

3535
def free_arguments(fun: Union[Callable, partial]) -> Set[str]:
36-
"""Computes the set of free arguments for a function or [partial object][].
36+
"""Computes the set of free arguments for a function or
37+
[functools.partial][] object.
3738
3839
All arguments of a function are considered free unless they are set by a
3940
partial. For example, if `f = partial(g, a=1)`, then `a` is not a free
@@ -44,12 +45,15 @@ def free_arguments(fun: Union[Callable, partial]) -> Set[str]:
4445
4546
Returns:
4647
The set of free arguments of `fun`.
48+
49+
!!! tip "New in version 0.7.0"
4750
"""
4851
args_set_by_partial: Set[str] = set()
4952

5053
def _rec_unroll_partial_function_args(g: Union[Callable, partial]) -> Callable:
51-
"""Stores arguments and recursively call itself if `g` is a partial. In
52-
the end, returns the initially wrapped function.
54+
"""Stores arguments and recursively call itself if `g` is a
55+
[functools.partial][] object. In the end, returns the initially wrapped
56+
function.
5357
5458
This handles the construct `partial(_accept_additional_argument, *args,
5559
**kwargs)` that is used by `maybe_add_argument`.
@@ -94,6 +98,9 @@ def maybe_add_argument(fun: Callable, new_arg: str) -> Callable:
9498
9599
Returns:
96100
A new function accepting one more keyword argument.
101+
102+
!!! tip "Changed in version 0.7.0"
103+
Ability to work with partials.
97104
"""
98105
if new_arg in free_arguments(fun):
99106
return fun

src/pydvl/utils/parallel/map_reduce.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@
1515
from numpy.typing import NDArray
1616

1717
from ..config import ParallelConfig
18-
from ..types import (
19-
MapFunction,
20-
ReduceFunction,
21-
Seed,
22-
ensure_seed_sequence,
23-
)
2418
from ..functional import maybe_add_argument
19+
from ..types import MapFunction, ReduceFunction, Seed, ensure_seed_sequence
2520
from .backend import init_parallel_backend
2621

2722
__all__ = ["MapReduceJob"]

src/pydvl/utils/types.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
from numpy.random import Generator, SeedSequence
1010
from numpy.typing import NDArray
1111

12-
__all__ = ["SupervisedModel", "MapFunction", "ReduceFunction", "NoPublicConstructor"]
12+
__all__ = [
13+
"ensure_seed_sequence",
14+
"MapFunction",
15+
"NoPublicConstructor",
16+
"ReduceFunction",
17+
"Seed",
18+
"SupervisedModel",
19+
]
1320

1421
R = TypeVar("R", covariant=True)
1522

@@ -83,6 +90,8 @@ def ensure_seed_sequence(
8390
8491
Returns:
8592
A SeedSequence object.
93+
94+
!!! tip "New in version 0.7.0"
8695
"""
8796
if isinstance(seed, SeedSequence):
8897
return seed

src/pydvl/value/loo/loo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def compute_loo(
3232
Returns:
3333
Object with the data values.
3434
35-
!!! tip "New in version 0.8.0"
35+
!!! tip "New in version 0.7.0"
3636
Renamed from `naive_loo` and added parallel computation.
3737
"""
3838

src/pydvl/value/shapley/montecarlo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ def _combinatorial_montecarlo_shapley(
241241
job_id: int = 1,
242242
seed: Optional[Seed] = None,
243243
) -> ValuationResult:
244-
"""Helper function for [combinatorial_montecarlo_shapley()][pydvl.value.shapley.montecarlo.combinatorial_montecarlo_shapley].
244+
"""Helper function for
245+
[combinatorial_montecarlo_shapley][pydvl.value.shapley.montecarlo.combinatorial_montecarlo_shapley].
245246
246247
This is the code that is sent to workers to compute values using the
247248
combinatorial definition.
@@ -252,7 +253,8 @@ def _combinatorial_montecarlo_shapley(
252253
done: Check on the results which decides when to stop sampling
253254
subsets for an index.
254255
progress: Whether to display progress bars for each job.
255-
seed: Either an instance of a numpy random number generator or a seed for it.
256+
seed: Either an instance of a numpy random number generator or a seed
257+
for it.
256258
job_id: id to use for reporting progress
257259
258260
Returns:

0 commit comments

Comments
 (0)