I am training a model on a data set that has imbalanced classes; 97% of the labels are 0 and 3% are 1s.

I chose to upsample the data in order to make the classes equal in the model training.

When I run my model against the best params from a GridSearch, I get a relatively low F1 score (using the upsampled data):

              precision    recall  f1-score   support

       False       1.00      0.98      0.99    187036
        True       0.61      0.99      0.76      5306

    accuracy                           0.98    192342
   macro avg       0.81      0.99      0.87    192342
weighted avg       0.99      0.98      0.98    192342

However, when I do the same operation on the data with the imbalanced classes, I get much better results:

              precision    recall  f1-score   support

       False       1.00      1.00      1.00    187036
        True       0.85      0.86      0.85      5306

    accuracy                           0.99    192342
   macro avg       0.92      0.93      0.92    192342
weighted avg       0.99      0.99      0.99    192342

I am wondering what might be driving this. I would imagine that upsampling would almost universally be better. I am willing to accept this is not the case, but just trying to understand what is driving this.


Your Answer

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

Browse other questions tagged or ask your own question.