Nerval
atr_ner_eval.metrics.nerval
Compute Precision, Recall and F1 from a label/prediction dataset.
Attributes
NERVAL_GLOBAL_STAT
module-attribute
NERVAL_GLOBAL_STAT = 'All'
METRICS
module-attribute
METRICS = ['predicted', 'matched', 'Support']
Functions
compute_precision
compute_precision(matched: int, predicted: int) -> float
Compute precision.
Source code in atr_ner_eval/metrics/nerval.py
30 31 32 33 34 |
|
compute_recall
compute_recall(matched: int, support: int) -> float
Compute recall.
Source code in atr_ner_eval/metrics/nerval.py
37 38 39 40 41 |
|
compute_f1
compute_f1(precision: float, recall: float) -> float
Compute F1 score.
Source code in atr_ner_eval/metrics/nerval.py
44 45 46 47 48 |
|
compute_nerval
compute_nerval(
label_dir: Path,
prediction_dir: Path,
threshold: float,
by_category: bool = False,
) -> None
Read BIO files and compute Precision, Recall and F1 globally or for each NER category.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label_dir |
Path
|
Path to the reference BIO file. |
required |
prediction_dir |
Path
|
Path to the prediction BIO file. |
required |
threshold |
float
|
Character Error Rate threshold used to match entities. |
required |
by_category |
bool
|
Whether to display Precision/Recall/F1 by category. |
False
|
Returns:
Type | Description |
---|---|
None
|
A Markdown formatted table containing evaluation results. |
Source code in atr_ner_eval/metrics/nerval.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|