Skip to content

Averaging

Aliases#

The following lists all implemented metric averaging methods, by alias. These can be used when composing metrics using metric syntax strings.

Alias Metric sklearn
'binary' SelectPositiveClass binary
'geom' GeometricMean
'geometric' GeometricMean
'harm' HarmonicMean
'harmonic' HarmonicMean
'macro' MacroAverage macro
'macro_average' MacroAverage macro
'mean' MacroAverage macro
'micro' WeightedAverage weighted
'micro_average' WeightedAverage weighted
'select' SelectPositiveClass binary
'select_positive' SelectPositiveClass binary
'weighted' WeightedAverage weighted
'weighted_average' WeightedAverage weighted

Abstract Base Class#

Averaging #

The abstract base class for metric averaging.

Properties should be implemented as class attributes in derived metrics.

The compute_average method needs to be implemented

Attributes#

dependencies abstractmethod instance-attribute property #

All metrics upon which this metric averaging method depends.

Constructed from the union of all Metric and AveragingMethod dependencies.

Used to generate a computation schedule, such that no metric is calculated before its dependencies.

The dependencies must match the compute_average signature.

This is checked during class definition.

sklearn_equivalent abstractmethod instance-attribute property #

The sklearn equivalent function, if applicable.

aliases abstractmethod instance-attribute property #

A list of all valid aliases for this metric averaging method.

Can be used when creating metric syntax strings.

Functions#

compute_average abstractmethod #

Computes the average across experiment classes.

Metric Instances#

MacroAverage #

Bases: Averaging

Computes the arithmetic mean over all classes, also known as macro-averaging.

aliases = ['macro', 'macro_average', 'mean'] #

dependencies = () #

sklearn_equivalent = 'macro' #

WeightedAverage #

Bases: Averaging

Computes the prevalence weighted mean over all classes, also known as weighted averaging.

aliases = ['weighted', 'weighted_average', 'micro', 'micro_average'] #

dependencies = ('p_condition',) #

sklearn_equivalent = 'weighted' #

SelectPositiveClass #

Bases: Averaging

Selects only the positive class, also known as binary averaging.

aliases = ['select_positive', 'binary', 'select'] #

dependencies = () #

sklearn_equivalent = 'binary' #

HarmonicMean #

Bases: Averaging

Computes the harmonic mean over all classes.

aliases = ['harmonic', 'harm'] #

dependencies = () #

sklearn_equivalent = None #

GeometricMean #

Bases: Averaging

Computes the geometric mean over all classes.

aliases = ['geometric', 'geom'] #

dependencies = () #

sklearn_equivalent = None #