span

class SpanEvaluator[源代码]

基类:paddle.metric.metrics.Metric

SpanEvaluator computes the precision, recall and F1-score for span detection.

compute(start_probs, end_probs, gold_start_ids, gold_end_ids)[源代码]

Computes the precision, recall and F1-score for span detection.

update(num_correct_spans, num_infer_spans, num_label_spans)[源代码]

This function takes (num_infer_spans, num_label_spans, num_correct_spans) as input, to accumulate and update the corresponding status of the SpanEvaluator object.

eval_span(predict_start_ids, predict_end_ids, label_start_ids, label_end_ids)[源代码]

evaluate position extraction (start, end) return num_correct, num_infer, num_label input: [1, 2, 10] [4, 12] [2, 10] [4, 11] output: (1, 2, 2)

accumulate()[源代码]

This function returns the mean precision, recall and f1 score for all accumulated minibatches.

返回

Returns tuple (precision, recall, f1 score).

返回类型

tuple

reset()[源代码]

Reset function empties the evaluation memory for previous mini-batches.

name()[源代码]

Return name of metric instance.