get_prev_from_labels#
- mlquantify.utils.get_prev_from_labels(y, format='dict', classes: list | None = None)[source]#
Get the real prevalence of each class in the target array.
- Parameters:
- ynp.ndarray or pd.Series
Array of class labels.
- formatstr, default=”dict”
Format of the output. Can be “array” or “dict”.
- classeslist, optional
List of unique classes. If provided, the output will be sorted by these classes.
- Returns:
- dict or np.ndarray
Dictionary of class labels and their corresponding prevalence or array of prevalences.