Ok, so in order to get an averaging (in a binary classification), one must
give `pos_label = None`, like this:
metrics.f1_score(y_true, y_predicted, average='macro', pos_label=None)
This is not very clear in the comments.
In any case, it maybe coding/organizing style, because I would rather
> So as it says, giving 'pos_label' explicitly solves the issue. I will
> now check the code more thoroughly to understand why the default value
> for pos_label (which is 1) cannot be used while calculating averages in
> a binary classification.
Excellent. Keep us posted!
I was checking the blame for the file, and I found that the current file in
github has an explanation for this:
average : string, [None (default), 'micro', 'macro', 'weighted']
If ``None``, the scores for each class are returned. Otherwise,
unless ``pos_label`` is given in binary classification,
On Mon, May 13, 2013 at 10:41:31PM +, Pavel Soriano wrote:
> In Manning's Introduction to Information Retrieval (pg. 260) they show
> it is possible to obtain it.(In fact I modified this line, in metrics.py, and
> the value was indeed returned, after a macro averaging.)
> I guess I am missing
I am currently assessing the performance of a logit classifier, and I
wonder why is the “average” option, for the F-score metric, is not taken
into account when using a binary classifier. I am talking about line 1091
of metrics.py (sklearn.metrics):
elif n_labels == 2 and pos_label is not None: