pydvl.valuation.methods.random
¶
This module implements a trivial random valuation method.
It exists mainly for convenience when running experiments, e.g. when comparing methods with point removal, random values are a simple (albeit weak) baseline.
RandomValuation
¶
Bases: Valuation
A trivial valuation method that assigns random values to each data point.
Values are in the range [0, 1), as generated by ValuationResult.from_random.
Successive calls to fit() will generate different values.
PARAMETER | DESCRIPTION |
---|---|
random_state
|
Random seed for reproducibility.
TYPE:
|
Source code in src/pydvl/valuation/methods/random.py
fit
¶
fit(data: Dataset, continue_from: ValuationResult | None = None) -> Self
Dummy fitting that generates a set of random values.
Successive calls will generate different values.
PARAMETER | DESCRIPTION |
---|---|
data
|
used to determine the size of the valuation result
TYPE:
|
continue_from
|
(For consistency with other valuation methods) If this argument provided, the result is initialized with this object. The random values are added to the existing values.
TYPE:
|
Source code in src/pydvl/valuation/methods/random.py
values
¶
values(sort: bool = False) -> ValuationResult
Returns a copy of the valuation result.
The valuation must have been run with fit()
before calling this method.
PARAMETER | DESCRIPTION |
---|---|
sort
|
Whether to sort the valuation result by value before returning it.
TYPE:
|
Returns: The result of the valuation.