kk7nc/Text_Classification

Classification metrics can't handle a mix of multiclass and continuous-multioutput targets

wanderfernandesjunior opened this issue · 4 comments

Dear Kowsari,

Thanks for sharing this great text classification survey. I am using this work as a reference for my master's degree in which I will perform classification of industrial safety alert texts.

When replicating code relating to neural networks, I found a slight inconsistency in the following line of README.md (item Deep Learning -> Deep Neural Networks):

print(metrics.classification_report (y_test, predicted))

ValueError: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets

I evaluated the shapes of y_test and predicted in this case:
predicted.shape: (7532, 20)
y_test.shape: (7532,)

So I suggest the following change in the line above to:

print(metrics.classification_report (y_test, np.argmax(predicted, axis = 1)))

Regards,
Wander

kk7nc commented

Thank you for creating an issue I will fix it

Great job man

@wanderfernandesjunior I got the same error using multilabel_confusion_matrix() and I solved it using your suggestion. Thanks!

I used your suggestion and it solved a problem I have been trying to fix for like half a week. Thank you very much @wanderfernandesjunior