Metrics¶
Epoch metrics are metrics calculated only at the end of every epoch. They need to be implemented following the interface class, but we provide an exhaustive list.
Epoch Metric Interface¶

class
poutyne.framework.metrics.
EpochMetric
[source]¶ The abstract class representing a epoch metric which can be accumulated at each batch and calculated at the end of the epoch.
Epoch Metrics¶

class
poutyne.framework.metrics.
FBeta
(metric: str = 'fscore', average: str = 'micro', beta: float = 1.0)[source]¶ The source code of this class is under the Apache v2 License and was copied from the AllenNLP project and has been modified.
Compute precision, recall, Fmeasure and support for each class.
The precision is the ratio
tp / (tp + fp)
wheretp
is the number of true positives andfp
the number of false positives. The precision is intuitively the ability of the classifier not to label as positive a sample that is negative.The recall is the ratio
tp / (tp + fn)
wheretp
is the number of true positives andfn
the number of false negatives. The recall is intuitively the ability of the classifier to find all the positive samples.The Fbeta score can be interpreted as a weighted harmonic mean of the precision and recall, where an Fbeta score reaches its best value at 1 and worst score at 0.
If we have precision and recall, the Fbeta score is simply:
Fbeta = (1 + beta ** 2) * precision * recall / (beta ** 2 * precision + recall)
The Fbeta score weights recall more than precision by a factor of
beta
.beta == 1.0
means recall and precision are equally important.The support is the number of occurrences of each class in
y_true
. Parameters
metric (str) – One of {‘fscore’, ‘precision’, ‘recall’}. Wheter to return the Fscore, the precision or the recall. (Default value = ‘fscore’)
One of {‘micro’ (default), ‘macro’, label_number} If the argument is of type integer, the score for this class (the label number) is calculated. Otherwise, this determines the type of averaging performed on the data:
'micro'
:Calculate metrics globally by counting the total true positives, false negatives and false positives.
'macro'
:Calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account.
(Default value = ‘micro’)
beta (float) – The strength of recall versus precision in the Fscore. (Default value = 1.0)