seqeval is a Python framework for sequence labeling evaluation. It provides metrics like F1 score, precision, recall, and a detailed classification report for tasks such as named-entity recognition and part-of-speech tagging. It is currently at version 1.2.2 and maintains an active release cadence, with updates often focusing on performance improvements and additional evaluation schemes.
pip install seqevalVerified import paths — ran on the pinned version, not inferred.
Calculate the F1-score and generate a detailed classification report for sequence labeling predictions.
Review calls to `classification_report` and explicitly pass the desired `scheme` and `mode` parameters (e.g., `classification_report(y_true, y_pred, scheme=IOB2, mode='strict')`) to ensure correct evaluation behavior. Refer to the documentation for supported schemes.
Be aware of this fundamental difference when comparing evaluation results. For true entity-level evaluation in NLP sequence labeling, `seqeval` is generally preferred. If comparing with `scikit-learn`, ensure a clear understanding of what each metric is actually measuring.
Understand the implications of `mode='strict'`. If evaluating with `mode='strict'`, ensure your `y_true` and `y_pred` are consistent with a strict tagging scheme (like IOB2 or BILOU) and that this level of strictness is appropriate for your task.
Ensure that your true and predicted labels are properly converted from numerical IDs to their corresponding string tags (e.g., 'O', 'B-PER', 'I-PER') before passing them to `seqeval` metric functions.
Upgrade to `seqeval` version 1.2.1 or newer to benefit from performance enhancements, especially if you are performing evaluations in `strict` mode or on large datasets.
pip install seqeval
from seqeval.metrics import classification_report
Ensure `y_true` and `y_pred` are structured as `list[list[str]]`, where each inner list represents tags for a sentence.
Use one of the valid mode strings: 'strict', 'exact', 'partial', or 'type'.
No dependency data recorded yet.