I am trying to do multiclass classification for the sentence pair task. I uploaded my custom dataset of train and test separately in the hugging face data set and trained my model and tested it and was trying to see the f1 score and accuracy.
I tried
from datasets import load_metric
metric1 = load_metric("precision")
metric2 = load_metric("recall")
metric3 = load_metric("f1")
metric = load_metric('accuracy')
def compute_metrics(eval_pred):
metric1 = load_metric("precision")
metric2 = load_metric("recall")
metric3 = load_metric("f1")
metric4 = load_metric("accuracy")
logits, labels = eval_pred
predictions = np.argmax(logits, axis=-1)
precision = metric1.compute(predictions=predictions, references=labels,average ="micro")["precision"]
recall = metric2.compute(predictions=predictions, references=labels,average ="micro")["recall"]
f1 = metric3.compute(predictions=predictions, references=labels,average ="micro")["f1"]
accuracy = metric4.compute(predictions=predictions, references=labels,average ="micro")["accuracy"]
return {"precision": precision, "recall": recall, "f1": f1, "accuracy": accuracy}
but it says
ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].
How can I fix this and print precision, recall, and f1 score?