Reputation: 425
I would like to plot a scatter plot like this, where you can see the wrong predicted and true predicitons of a classifier including the numbers of the predicitons
i tried with this scatter plot till now
predictions_rf = rf.predict(X_test)
plt.figure(figsize=(10,10))
plt.gca().set_aspect('equal', adjustable='box')
plt.scatter(Y_test,predictions_rf)
plt.xlabel("True Values")
plt.ylabel("Predictions")
and i got a scatter plot like this: It is possible to see the wrong estimated ones as well but not diagonally and not with the numbers the model predicted right and wrong
How could I improve my code to get a solution like the first one?
Thank you
Upvotes: 0
Views: 602
Reputation: 2963
What you are trying to plot is a confusion matrix.
Sklearn's confusion matrix described here does exactly what you're looking for.
Upvotes: 2