Update spacy/cli/find_threshold.py

Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
This commit is contained in:
Raphael Mitsch 2022-09-29 10:40:30 +02:00 committed by GitHub
parent 65e41a52dd
commit 604c5eab3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,9 +167,7 @@ def find_threshold(
)
scores[threshold] = nlp.evaluate(dev_dataset)[scores_key]
if not isinstance(scores[threshold], float) and not isinstance(
scores[threshold], int
):
if not isinstance(scores[threshold], (float, int)):
wasabi.msg.fail(
f"Returned score for key '{scores_key}' is not numeric. Threshold optimization only works for numeric "
f"scores.",