So I am doing some machine learning with Python using Jupiter notebook and I have a problem with the output format with sklearn classification_report. There are two version. One which is 0.18.2 and the other is 0.20.3. The 20.3 version has the following output with my code:

from sklearn.metrics import classification_report
final=(classification_report(y_test, predictions))
print(final) 


            precision  recall   fl-score  support   
Female        0.47.      0.21.      0.34.   26 
Male.         0.71       0.85.      0.78.   55 

micro avg     0.67.      0.67.      0.67.   81 
macro avg.    0.59.      0.56       0.56.   81 
weighted avg  0.63.      0.67.      0.64.   81          

however, I want the following output to be like this:

              precision  recall   fl-score  support   
Female        0.47.      0.21.      0.34.   26 
Male.         0.71       0.85.      0.78.   55 

avg/total.    0.63.      0.67.      0.64.   81  

The above output is the 0.18.2 version of sklearn classification report which is not running with my version for some reason. The syntax for output is the same in both 0.18.2 and 0.20.3. Is there a way to switch versions back and forth in Jupiter notebook? Any advice would be appreciated.

0 Answers