UPP#
- class mlquantify.model_selection.UPP(batch_size, n_prevalences, repeats=1, random_state=None, min_prev=0.0, max_prev=1.0, algorithm='kraemer')[source]#
Uniform Prevalence Protocol (UPP).
Similar to
APP, but samples prevalences uniformly over the probability simplex rather than on a regular grid, avoiding bias towards the simplex corners. Supports Kraemer or uniform simplex sampling.- Parameters:
- batch_sizeint or list of int
Batch size(s) for evaluation.
- n_prevalencesint
Number of prevalence points to sample.
- repeatsint, default=1
Number of repetitions for each prevalence point.
- random_stateint or None, default=None
Random seed for reproducibility.
- min_prevfloat, default=0.0
Minimum class prevalence.
- max_prevfloat, default=1.0
Maximum class prevalence.
- algorithm{‘kraemer’, ‘uniform’}, default=’kraemer’
Simplex sampling algorithm.
'kraemer'uses the Kraemer method;'uniform'uses uniform Dirichlet sampling.
- Attributes:
- n_combinationsint
Total number of batches generated.
Examples
>>> from mlquantify.model_selection import UPP >>> import numpy as np >>> X, y = np.random.randn(200, 5), np.random.randint(0, 2, 200) >>> proto = UPP(batch_size=50, n_prevalences=5, random_state=0) >>> batches = list(proto.split(X, y)) >>> len(batches) 5
- get_metadata_routing()[source]#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- get_params(deep=True)[source]#
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- set_params(**params)[source]#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.