F1 is a metric of performance for classification algorithms that for binary classification is equal to .
For multiclass classification the F1 metric can be used with the following strategies for averaging.
Micro. The result is calculated by the above formula, but microaveraged precision and microaveraged recall are used.
Macro. F1 is calculated for each class (with values used for calculation of macroaveraged precision and macroaveraged recall), and then the F1 values are averaged.
In the case of multiclass classification it is assumed that there are instances of every label from 0 to max(labels) among input data points.
The returned value for F1 will be zero if both precision and recall turn out to be zeros.
Template Parameters
AS
An average strategy.
PositiveClass
In the case of binary classification (AS = Binary) positives are assumed to have labels equal to this value.