Classification Metrics Can't Handle A Mix Of Continuous-multioutput And Multi-label-indicator Targets
I have created an ANN with numerical inputs and a single categorical output which is one hot encoded to be 1 of 19 categories. I set my output layer to have 19 units. I don't know
Solution 1:
y_pred = (y_pred > 0.5)
Outputs a boolean matrix. The problem is that it has the same shape as it had before, but when you evaluate accuracy you need a vector of labels.
To do this take np.argmax(y_pred, axis=1)
instead to output correct labels.
Solution 2:
To sum this up: with this code you should get your matrix
y_pred=model.predict(X_test)
y_pred=np.argmax(y_pred, axis=1)
y_test=np.argmax(y_test, axis=1)
cm = confusion_matrix(y_test, y_pred)
print(cm)
Post a Comment for "Classification Metrics Can't Handle A Mix Of Continuous-multioutput And Multi-label-indicator Targets"