1 year ago
#50749
Samriddhee Ghosh
Classification Metrics for Sequential tagging in NLP
I am writing one sequential tagging code in NLP using python google colab. As I have used crf layer in my model, I used crf.metrices to get the results . I had executed the following code : //
pred_cat = model.predict(X_te)
pred = np.argmax(pred_cat, axis=-1)
y_te_true = np.argmax(y_te, axis=-1)
tags=['O', 'BOC', 'IOC','<pad>']
from sklearn_crfsuite import metrics as crf_metrics
print(crf_metrics.flat_classification_report(y_true=y_te_true,y_pred=pred,labels=tags))
//
I am getting the following error:
TypeError Traceback (most recent call last)
<ipython-input-21-510856efb26d> in <module>()
1 from sklearn_crfsuite import metrics as crf_metrics
----> 2 print(crf_metrics.flat_classification_report(y_true=y_te_true,y_pred=pred,labels=tags))
1 frames
/usr/local/lib/python3.7/dist-packages/sklearn_crfsuite/metrics.py in flat_classification_report(y_true, y_pred, labels, **kwargs)
66 """
67 from sklearn import metrics
---> 68 return metrics.classification_report(y_true, y_pred, labels, **kwargs)
69
70
TypeError: classification_report() takes 2 positional arguments but 3 were given
Can anyone please throw some light on this?
nlp
metrics
tagging
sequential
crf
0 Answers
Your Answer