From 866e7547d9419f3d8c2bb9b7026c5caffb7bf0bd Mon Sep 17 00:00:00 2001 From: Anes Benmerzoug Date: Fri, 29 Mar 2024 17:05:13 +0100 Subject: [PATCH] Update docstrings --- src/pydvl/value/least_core/montecarlo.py | 16 ++++++++++++++++ src/pydvl/value/loo/loo.py | 5 +++-- src/pydvl/value/shapley/classwise.py | 5 ++++- src/pydvl/value/shapley/gt.py | 5 +++++ src/pydvl/value/shapley/montecarlo.py | 10 ++++++++++ src/pydvl/value/shapley/naive.py | 5 +++++ src/pydvl/value/shapley/owen.py | 5 +++++ 7 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/pydvl/value/least_core/montecarlo.py b/src/pydvl/value/least_core/montecarlo.py index 44e16de79..5d68a46c8 100644 --- a/src/pydvl/value/least_core/montecarlo.py +++ b/src/pydvl/value/least_core/montecarlo.py @@ -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, @@ -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, @@ -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) diff --git a/src/pydvl/value/loo/loo.py b/src/pydvl/value/loo/loo.py index 12d6562c3..24081f83e 100644 --- a/src/pydvl/value/loo/loo.py +++ b/src/pydvl/value/loo/loo.py @@ -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") diff --git a/src/pydvl/value/shapley/classwise.py b/src/pydvl/value/shapley/classwise.py index ce4f9fdc1..d7a2dab05 100644 --- a/src/pydvl/value/shapley/classwise.py +++ b/src/pydvl/value/shapley/classwise.py @@ -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] @@ -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) diff --git a/src/pydvl/value/shapley/gt.py b/src/pydvl/value/shapley/gt.py index b7d799a5a..7a68f7b06 100644 --- a/src/pydvl/value/shapley/gt.py +++ b/src/pydvl/value/shapley/gt.py @@ -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) diff --git a/src/pydvl/value/shapley/montecarlo.py b/src/pydvl/value/shapley/montecarlo.py index 2d1caf80a..700ec9981 100644 --- a/src/pydvl/value/shapley/montecarlo.py +++ b/src/pydvl/value/shapley/montecarlo.py @@ -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" @@ -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) diff --git a/src/pydvl/value/shapley/naive.py b/src/pydvl/value/shapley/naive.py index 066c91a57..ca06da15c 100644 --- a/src/pydvl/value/shapley/naive.py +++ b/src/pydvl/value/shapley/naive.py @@ -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: diff --git a/src/pydvl/value/shapley/owen.py b/src/pydvl/value/shapley/owen.py index ce2ef7679..68c76db56 100644 --- a/src/pydvl/value/shapley/owen.py +++ b/src/pydvl/value/shapley/owen.py @@ -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)