Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function score = f1Score(actual, prediction)
  2.  
  3. precision = sum(actual & prediction) / sum(prediction);
  4. recall = sum(actual & prediction) / sum(actual);
  5.  
  6. score = 2 * (precision * recall) / (precision + recall);
  7.  
  8. if isnan(score)
  9. score = 0;
  10. end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement