From 052db9f8ba0299e7b69ec79bc7719fed313c4152 Mon Sep 17 00:00:00 2001 From: Kaushik Acharya Date: Sat, 3 Oct 2020 14:23:57 +0530 Subject: [PATCH] spelling correction in performance_measure() --- seqeval/metrics/sequence_labeling.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/seqeval/metrics/sequence_labeling.py b/seqeval/metrics/sequence_labeling.py index 84b81ca..8cc3719 100644 --- a/seqeval/metrics/sequence_labeling.py +++ b/seqeval/metrics/sequence_labeling.py @@ -285,19 +285,19 @@ def performance_measure(y_true, y_pred): >>> performance_measure(y_true, y_pred) {'TP': 3, 'FP': 3, 'FN': 1, 'TN': 4} """ - performace_dict = dict() + performance_dict = dict() if any(isinstance(s, list) for s in y_true): y_true = [item for sublist in y_true for item in sublist] y_pred = [item for sublist in y_pred for item in sublist] - performace_dict['TP'] = sum(y_t == y_p for y_t, y_p in zip(y_true, y_pred) - if ((y_t != 'O') or (y_p != 'O'))) - performace_dict['FP'] = sum(((y_t != y_p) and (y_p != 'O')) for y_t, y_p in zip(y_true, y_pred)) - performace_dict['FN'] = sum(((y_t != 'O') and (y_p == 'O')) - for y_t, y_p in zip(y_true, y_pred)) - performace_dict['TN'] = sum((y_t == y_p == 'O') - for y_t, y_p in zip(y_true, y_pred)) - - return performace_dict + performance_dict['TP'] = sum(y_t == y_p for y_t, y_p in zip(y_true, y_pred) + if ((y_t != 'O') or (y_p != 'O'))) + performance_dict['FP'] = sum(((y_t != y_p) and (y_p != 'O')) for y_t, y_p in zip(y_true, y_pred)) + performance_dict['FN'] = sum(((y_t != 'O') and (y_p == 'O')) + for y_t, y_p in zip(y_true, y_pred)) + performance_dict['TN'] = sum((y_t == y_p == 'O') + for y_t, y_p in zip(y_true, y_pred)) + + return performance_dict def classification_report(y_true, y_pred, digits=2, suffix=False):