2
$\begingroup$

I was looking at the Tensorflow tutorial on "Classification on Imbalanced Data". Now they first show how to apply some approaches to deal with imbalance using model weights and a pre-initialized bias that conforms to the level of imbalance in the dataset. The tutorial uses logistic regression.

The second approach that they show involves Random Oversampling of the data to include more of the minority class. This approach seems very promising since I have a very very imbalanced dataset.

My question was, if I am training using Random Over/Undersampling, should I keep the class weights in the loss function? Should I keep the bias initializer, or not? I was not sure whether having class weights and biases would impair the over/undersampling? Seems like this would just make the system learn the weights faster, but it might also promote overfitting if the classes are more balanced.?

$\endgroup$
2
$\begingroup$

No. After you use resampling, you get 50% positive and 50% negative samples. If you calculate the bias and class_weight, the bias should be zero and the class_weight is (0.5,0.5). Hence they are indeed useless in your optimization.

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

You should adjust the weights/bias according to the final class balance in your model. In other words, if you correctly balance the classes by over/under sampling, you do not need to adjust the weights or bias.

| cite | improve this answer | |
$\endgroup$

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.