Spaces:
Runtime error
Runtime error
File size: 658 Bytes
9c323ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
"""
The utility functions of loglizer
Authors:
LogPAI Team
"""
from sklearn.metrics import precision_recall_fscore_support
import numpy as np
def metrics(y_pred, y_true):
""" Calucate evaluation metrics for precision, recall, and f1.
Arguments
---------
y_pred: ndarry, the predicted result list
y_true: ndarray, the ground truth label list
Returns
-------
precision: float, precision value
recall: float, recall value
f1: float, f1 measure value
"""
precision, recall, f1, _ = precision_recall_fscore_support(y_true, y_pred, average='binary')
return precision, recall, f1
|