Metrics

webstruct.metrics contains metric functions that can be used for model developmenton: on their own or as scoring functions for scikit-learn’s cross-validation and model selection.

webstruct.metrics.avg_bio_f1_score(y_true, y_pred)[source]

Macro-averaged F1 score of lists of BIO-encoded sequences y_true and y_pred.

A named entity in a sequence from y_pred is considered correct only if it is an exact match of the corresponding entity in the y_true.

It requires https://github.com/larsmans/seqlearn to work.

webstruct.metrics.bio_classification_report(y_true, y_pred)[source]

Classification report for a list of BIO-encoded sequences. It computes token-level metrics and discards “O” labels.