Premium problem62. Precision, Recall, and F1 Score

Medium Locked

For binary labels y_true/y_pred (0s and 1s), compute precision, recall, and F1 score by hand from true/false positives/negatives. Return a length-3 tensor [precision, recall, f1].

Input

y_true = tensor([1, 0, 1, 1, 0, 1])
y_pred = tensor([1, 0, 0, 1, 0, 0])

Output

tensor([1.0000, 0.5000, 0.6667])

Premium problem

This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.

Implement solve(...)