2

I am using precision_recall_fscore_support from sklearn to calculate the micro-precision, and micro-recall.

The problem is that the function returns the exact same value for both of them. It is a multi-class classification problem and I am not sure what went wrong.

Here is the code:

t = precision_recall_fscore_support(y_test, classifier.predict(x_test), average='micro')
print(t)

Here is the output:

Micro accuracy: (0.3359375, 0.3359375, 0.3359375, None)

4
  • It's likely not a problem with the function but the predictions. How man values are there, can you include them in the post?
    – piman314
    Mar 17, 2018 at 7:54
  • I am not sure I understood your name, but if you're asking about how many samples then there are 128.
    – Wanderer
    Mar 19, 2018 at 6:29
  • 1
    Please show the complete data of y_test and the output of classifier.predict(x_test). Mar 19, 2018 at 9:15
  • Please tell us more about the data that you are working with. Also, get the result from classification_report and add it to the question so we know the scores for each of your class without considering the average
    – RPT
    Mar 19, 2018 at 12:10

1 Answer 1

5

What are you expecting to see? In section 3.3.2.8.2. of the documentation, here, it states “micro”-averaging in a multiclass setting with all labels included will produce equal precision, recall and F", and suggests you should try average = "weighted".

Here is a similar complaint on Scikit-learn's Github.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.