pythonpython-3.xmachine-learningscikit-learnmetrics

Macro VS Micro VS Weighted VS Samples F1 Score


In sklearn.metrics.f1_score, the f1 score has a parameter called "average". What does macro, micro, weighted, and samples mean? Please elaborate, because in the documentation, it was not explained properly. Or simply answer the following:

  1. Why is "samples" best parameter for multilabel classification?
  2. Why is micro best for an imbalanced dataset?
  3. what's the difference between weighted and macro?

Solution

  • The question is about the meaning of the average parameter in sklearn.metrics.f1_score.

    As you can see from the code: