In the book 'Text Analytics with Python', the author provides model_evaluation_utils.py
In the code of the .py he does:
I have two questions regarding it:
1- per the documentation average='weighted' shall only be used when having more than 2 classes, right? Why is he using average='weighted' when using only 2 classes?
2- Why do I get different results when I run?
print('Recall:', metrics.recall_score(test_sentiments,predicted_sentiments,pos_label='positive')) print('Recall:', metrics.recall_score(test_sentiments,predicted_sentiments,average='weighted'))
ps: I think that by using average='weighted' he is giving the wrong result, because the code doesn't know which one is the positive class, here is a like to the code of model_evaluation_utils.py https://github.com/dipanjanS/practical-machine-learning-with-python/blob/master/notebooks/Ch05_Building_Tuning_and_Deploying_Models/model_evaluation_utils.py