f1_score function

Computes the F1-score.