Skip to content Skip to sidebar Skip to footer

PyTorch Confusion Matrix Plot

I have met a problem for plotting a confusion matrix. The upper and lower lines are put incorrectly. When I plot it, it looks like this. I think there is nothing wrong with my cod

Solution 1:

You can change manually the range of the y axis.

plt.ylim(-0.5, len(names) - 0.5)

For some reason heuristic for estimating the axis range does not get that you are not only interested in the points you are plotting but also in the (-0.5; +0.5) surrounding on both axes.

The lowest points have y coordinate 0, the top-most points have y coordinate len(names) - 1.


Post a Comment for "PyTorch Confusion Matrix Plot"