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) for uniform sampling of artificial prevalences.
Similar to APP, but uses uniform prevalence distribution generation methods such as Kraemer or uniform simplex sampling to generate batches with uniformly sampled class prevalences.
- Parameters:
- batch_sizeint or list of int
Batch size(s) for evaluation.
- n_prevalencesint
Number of prevalence samples per class.
- repeatsint
Number of evaluation repeats with different samples.
- random_stateint, optional
Random seed for reproducibility.
- min_prevfloat, optional (default=0.0)
Minimum prevalence limit.
- max_prevfloat, optional (default=1.0)
Maximum prevalence limit.
- algorithm{‘kraemer’, ‘uniform’}, optional (default=’kraemer’)
Sampling algorithm used to generate artificial prevalences.
Examples
>>> protocol = UPP(batch_size=100, n_prevalences=5, repeats=3, random_state=42) >>> for idx in protocol.split(X, y): ... # Train and evaluate ... pass
- 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.