I am building a 2D Convolutional Neural Network for MFCC features for audio classification.

The issue I am facing is that there are 2 classes and huge imbalance between them. One class has 17687 samples while other has 67737 samples. I have done one hot encoding so I have two CNN outputs as [1,0] and [0,1].

From my research it seems that adding class_weights in model.fit only seems to work for binary classification problems. Is there any way I can assign weights to one hot encoded results?


You might want to consider using metrics such as the f1-score in order to measure how well your model does.

Notice that if, in real life, the inbalance will be of a similar nature, then your model has to account for it anyway.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.