averaging_mechanism#
- averaging_mechanism(averaging_method: str, scores_per_class, weights=None) Union[ndarray, float] [source]#
Receive scores per class and averaging method and returns result based on averaging_method.
- Parameters
- averaging_methodstr, default: ‘per_class’
Determines which averaging method to apply, possible values are: ‘per_class’: Return a np array with the scores for each class (sorted by class name). ‘binary’: Returns the score for the positive class. Should be used only in binary classification cases. ‘macro’: Returns the mean of scores per class. ‘weighted’: Returns a weighted mean of scores based provided weights.
- scores_per_classarray-like of shape (n_samples, n_classes)
The score of the metric per class when considering said class as the positive class and the remaining classes as the negative.
- weightsarray-like of shape (n_samples,), default: None
True labels. Only required for ‘weighted’ averaging method.
- Returns
- scoreUnion[np.ndarray, float]
The score for the given metric.