Skip to content

f1_measure

allennlp.training.metrics.f1_measure

[SOURCE]


F1Measure

@Metric.register("f1")
class F1Measure(FBetaMeasure):
 | def __init__(self, positive_label: int) -> None

Computes Precision, Recall and F1 with respect to a given positive_label. For example, for a BIO tagging scheme, you would pass the classification index of the tag you are interested in, resulting in the Precision, Recall and F1 score being calculated for this tag only.

get_metric

class F1Measure(FBetaMeasure):
 | ...
 | def get_metric(self, reset: bool = False) -> Dict[str, float]

Returns

  • precision : float
  • recall : float
  • f1-measure : float