return metrics.classification_report(y_true, y_pred, labels, **kwargs) TypeError: classification_report() takes 2 positional arguments but 3 were given
We are currently training a crf model and we wanted to get the classification report of the metrics but we got this error.
we tried to do this instead:
from sklearn.metrics import classification report print(classification_report(y_test, y_pred, labels='labels'))
and got this error:
ValueError: You appear to be using a legacy multi-label data representation. Sequence of sequences are no longer supported; use a binary array or sparse matrix instead - the MultiLabelBinarizer transformer can convert to this format.
So then we tried to convert it to a sparse matrix and also using the MultiLabel Binarizer and nothing worked. We can't seem to figure it out. does anyone know how this works?
# metrics on test dataset
print("For Testing Set: ")
print("F1 score: {}".format(metrics.flat_f1_score(y_test, y_pred, average='weighted')))
print("Precision score: {}".format(metrics.flat_precision_score(y_test, y_pred, average='weighted')))
print("Recall score: {}".format(metrics.flat_recall_score(y_test, y_pred, average='weighted', labels='labels')))
print(metrics.flat_classification_report(y_test, y_pred, labels='labels', digits=3))
above is our sample code