Computing F1 Score using sklearn
<p>I'm trying to figure out why the F1 score is what it is in <code>sklearn</code>. I understand that it is calculated as:</p>

<pre><code>F1 = 2 * (precision * recall) / (precision + recall)
</code></pre>

<p>My code:</p>

<pre><code>from sklearn.metrics import f1_score, precision_score, recall_score
...
fmeasure1 = f1_score(true_output, predicted_output, average="macro")
fmeasure2 = f1_score(true_output, predicted_output, average="micro")

precision = precision_score(true_output, predicted_output, average="macro")
recall = recall_score(true_output, predicted_output, average="macro")

print 2*(precision*recall)/(precision + recall), fmeasure1, fmeasure2
</code></pre>

<p>The values I get for my data are:</p>

<pre><code>0.785744255639 0.769527615775 0.984532095901
</code></pre>

<p>I don't understand why these three values are different from one another. I've tried reading the documentation <a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html" rel="nofollow noreferrer">here</a>, but I'm still quite lost.</p>

<p>My dataset is mutli-class and, by nature, highly imbalanced. Which of the values here is the "correct" value, and by extension, which among the parameters for average (i.e. None, micro, macro, weight) should I use? </p>

<p>Thanks, and any insight would be highly valuable.</p>