set_config#

mlquantify.set_config(prevalence_return_type=None, prevalence_normalization=None)[source]#

Set global mlquantify configuration.

Parameters:
prevalence_return_type{‘dict’, ‘array’}, default=None

The format of the returned prevalence estimates: - ‘dict’: Returns a dictionary mapping class labels to values. - ‘array’: Returns a numpy array of values. Global default: ‘dict’.

prevalence_normalization{‘sum’, ‘l1’, ‘softmax’, ‘mean’, ‘median’, None}, default=None

The strategy for normalizing or aggregating prevalence estimates: - ‘sum’ or ‘l1’: Normalizes values so that they sum to 1. - ‘softmax’: Applies the softmax function to the estimates. - ‘mean’: Takes the arithmetic mean of multiple estimates. - ‘median’: Takes the median of multiple estimates. - None: No normalization or aggregation is performed. Global default: ‘mean’.

See also

config_context

Context manager for global mlquantify configuration.

get_config

Retrieve current values of the global configuration.

Examples

>>> from mlquantify import set_config, get_config
>>> set_config(prevalence_return_type='array', prevalence_normalization='probs')
>>> get_config()['prevalence_normalization']
'probs'