Skip to content

Commit

Permalink
Merge pull request #49 from kaushikacharya/typo
Browse files Browse the repository at this point in the history
spelling correction in performance_measure()
  • Loading branch information
Hironsan committed Oct 3, 2020
2 parents 7cb0f32 + 052db9f commit 26b3bab
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions seqeval/metrics/sequence_labeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,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):
Expand Down

0 comments on commit 26b3bab

Please sign in to comment.