pydvl.value.least_core.montecarlo
¶
montecarlo_least_core
¶
montecarlo_least_core(
u: Utility,
n_iterations: int,
*,
n_jobs: int = 1,
parallel_backend: Optional[ParallelBackend] = None,
config: Optional[ParallelConfig] = None,
non_negative_subsidy: bool = False,
solver_options: Optional[dict] = None,
progress: bool = False,
seed: Optional[Seed] = None
) -> ValuationResult
Computes approximate Least Core values using a Monte Carlo approach.
Where:
- \(U(2^N)\) is the uniform distribution over the powerset of \(N\).
- \(m\) is the number of subsets that will be sampled and whose utility will be computed and used to compute the data values.
PARAMETER | DESCRIPTION |
---|---|
u |
Utility object with model, data, and scoring function
TYPE:
|
n_iterations |
total number of iterations to use
TYPE:
|
n_jobs |
number of jobs across which to distribute the computation
TYPE:
|
parallel_backend |
Parallel backend instance to use
for parallelizing computations. If
TYPE:
|
config |
(DEPRECATED) Object configuring parallel computation, with cluster address, number of cpus, etc.
TYPE:
|
non_negative_subsidy |
If True, the least core subsidy \(e\) is constrained to be non-negative.
TYPE:
|
solver_options |
Dictionary of options that will be used to select a solver and to configure it. Refer to cvxpy's documentation for all possible options. |
progress |
If True, shows a tqdm progress bar
TYPE:
|
seed |
Either an instance of a numpy random number generator or a seed for it.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ValuationResult
|
Object with the data values and the least core value. |
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.
Source code in src/pydvl/value/least_core/montecarlo.py
mclc_prepare_problem
¶
mclc_prepare_problem(
u: Utility,
n_iterations: int,
*,
n_jobs: int = 1,
parallel_backend: Optional[ParallelBackend] = None,
config: Optional[ParallelConfig] = None,
progress: bool = False,
seed: Optional[Seed] = None
) -> LeastCoreProblem
Prepares a linear problem by sampling subsets of the data. Use this to separate the problem preparation from the solving with lc_solve_problem(). Useful for parallel execution of multiple experiments.
See montecarlo_least_core for argument descriptions.
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.