This is my predictions outcome
array([[1., 0., 0.],
[0., 1., 0.],
[0., 1., 0.],
[0., 1., 0.],
[0., 1., 0.],
[0., 0., 1.],
[0., 1., 0.],
[0., 0., 1.],
[0., 1., 0.],
[0., 0., 1.],
[1., 0., 0.],
[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.],
[1., 0., 0.],
[0., 0., 1.],
[1., 0., 0.],
[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.],
[0., 1., 0.],
[0., 1., 0.],
[0., 1., 0.],
[0., 1., 0.],
[0., 0., 1.],
[1., 0., 0.]], dtype=float32)
and this is the confusion_matrix() function
cm = confusion_matrix(test_labels, predictions[:,0])
My query is how this confusion_matrix() functions works and how to solve this issue? As I am a novice it will be really helpful if anyone can give me a little explanation. Thank you.
This is primarily due to the shape of the arrays not being similar. Please check the arrays with test_labels.shape
etc. Then use the reshape
method or split them properly so that the shapes match.