How do we get f1 scores for our validation set?

after following lesson 2 here is what I did:

y = data.valid_ds.y.items
preds,y_hat,losses = learn.get_preds(with_loss=True)
from sklearn.metrics import classification_report
y_hat = np.argmax(preds,axis=1)
print(classification_report(y, y_hat, target_names=data.valid_ds.y.classes))

Is there a better way to do this?

1 Like

The answer is in this thread: F1 Score as metric

is this true?

according to this the f1beta only works for multiclass and it gives me an error when I tried using it.