I have been trying to get the classification report in the form of a dictionary. So according to the scikit-learn 0.20 documentation, I do:
from sklearn import metrics
rep = metrics.classification_report(y_true, y_pred, output_dict=True)
But get an error saying
TypeError: classification_report() got an unexpected keyword argument 'output_dict'
The scikit-learn module in my machine was initially 0.19.1 but even after updating it to 0.20, the same error message shows.
A classification report is a performance evaluation metric in machine learning. It is used to show the precision, recall, F1 Score, and support of your trained classification model.
A Classification report is used to measure the quality of predictions from a classification algorithm. How many predictions are True and how many are False. More specifically, True Positives, False Positives, True negatives and False Negatives are used to predict the metrics of a classification report as shown below.
support. Support is the number of actual occurrences of the class in the specified dataset. Imbalanced support in the training data may indicate structural weaknesses in the reported scores of the classifier and could indicate the need for stratified sampling or rebalancing.
This error should not show up as long as you have scikit-learn 0.20.0 installed. If you are trying this in a jupyter notebook, make sure the correct version reflects in your notebook using:
import sklearn
print(sklearn.__version__)
If you've upgraded scikit-learn but jupyter shows the wrong version of the package, make sure jupyter is installed in your current environment (and restart jupyter in a new terminal).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With