pydvl.valuation.samplers.msr
¶
MSRSampler
¶
MSRSampler(batch_size: int = 1, seed: Seed | None = None)
Bases: StochasticSamplerMixin
, IndexSampler
Sampler for unweighted Maximum Sample Re-use (MSR) valuation.
This is similar to a UniformSampler without an outer index.
PARAMETER | DESCRIPTION |
---|---|
batch_size |
Number of samples to generate in each batch.
TYPE:
|
seed |
Seed for the random number generator.
TYPE:
|
Source code in src/pydvl/valuation/samplers/msr.py
generate_batches
¶
Batches the samples and yields them.
Source code in src/pydvl/valuation/samplers/base.py
MSREvaluationStrategy
¶
MSREvaluationStrategy(
sampler: SamplerT,
utility: UtilityBase,
coefficient: Callable[[int, int], float] | None = None,
)
Bases: EvaluationStrategy[SamplerT, MSRValueUpdate]
Evaluation strategy for Maximum Sample Re-use (MSR) valuation.
The MSR evaluation strategy makes one utility evaluation per sample but generates
n_indices
many updates from it. The updates will be used to update two running
means that will later be combined into on final value. We send the
ValueUpdate.kind
field to ValueUpdateKind.POSITVE
or ValueUpdateKind.NEGATIVE
to decide which of the two running means is going to be updated.