Skip to content

Commit

Permalink
Update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AnesBenmerzoug committed Mar 29, 2024
1 parent 993e6ee commit 866e754
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/pydvl/value/least_core/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def montecarlo_least_core(
Returns:
Object with the data values and the least core value.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
problem = mclc_prepare_problem(
u,
Expand All @@ -102,6 +107,12 @@ def montecarlo_least_core(
)


@deprecated(
target=True,
args_mapping={"config": "config"},
deprecated_in="0.9.0",
remove_in="0.10.0",
)
def mclc_prepare_problem(
u: Utility,
n_iterations: int,
Expand All @@ -120,6 +131,11 @@ def mclc_prepare_problem(
See
[montecarlo_least_core][pydvl.value.least_core.montecarlo.montecarlo_least_core]
for argument descriptions.
!!! note "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
n = len(u.data)

Expand Down
5 changes: 3 additions & 2 deletions src/pydvl/value/loo/loo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def compute_loo(
!!! tip "New in version 0.7.0"
Renamed from `naive_loo` and added parallel computation.
!!! note "Changed in version 0.9.0"
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend configuration.
argument to allow users to pass the Parallel Backend instance
directly.
"""
if len(u.data) < 3:
raise ValueError("Dataset must have at least 2 elements")
Expand Down
5 changes: 4 additions & 1 deletion src/pydvl/value/shapley/classwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ def _permutation_montecarlo_classwise_shapley_one_step(
"""Helper function for [compute_classwise_shapley_values()]
[pydvl.value.shapley.classwise.compute_classwise_shapley_values].
Args:
u: Utility object containing model, data, and scoring function. The
scorer must be of type [ClasswiseScorer]
Expand All @@ -417,6 +416,10 @@ def _permutation_montecarlo_classwise_shapley_one_step(
Returns:
ValuationResult object containing computed data values.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend configuration.
"""
if done_sample_complements is None:
done_sample_complements = MaxChecks(1)
Expand Down
5 changes: 5 additions & 0 deletions src/pydvl/value/shapley/gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ def group_testing_shapley(
!!! tip "Changed in version 0.5.0"
Changed the solver to cvxpy instead of scipy's linprog. Added the ability
to pass arbitrary options to it.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""

n = len(u.data.indices)
Expand Down
10 changes: 10 additions & 0 deletions src/pydvl/value/shapley/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ def permutation_montecarlo_shapley(
Returns:
Object with the data values.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
algorithm = "permutation_montecarlo_shapley"

Expand Down Expand Up @@ -355,6 +360,11 @@ def combinatorial_montecarlo_shapley(
Returns:
Object with the data values.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
parallel_backend = _maybe_init_parallel_backend(parallel_backend, config)

Expand Down
5 changes: 5 additions & 0 deletions src/pydvl/value/shapley/naive.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ def combinatorial_exact_shapley(
Returns:
Object with the data values.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
# Arbitrary choice, will depend on time required, caching, etc.
if len(u.data) // n_jobs > 20:
Expand Down
5 changes: 5 additions & 0 deletions src/pydvl/value/shapley/owen.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ def owen_sampling_shapley(
!!! tip "Changed in version 0.5.0"
Support for parallel computation and enable antithetic sampling.
!!! tip "Changed in version 0.9.0"
Deprecated `config` argument and added a `parallel_backend`
argument to allow users to pass the Parallel Backend instance
directly.
"""
parallel_backend = _maybe_init_parallel_backend(parallel_backend, config)

Expand Down

0 comments on commit 866e754

Please sign in to comment.