Imbalanced Dataset
Learn how you can counter imbalanced data in binary cross-entropy loss of PyTorch.
We'll cover the following
Introduction to the imbalanced dataset
In our dummy example with two data points, we had one of each class: positive and negative. The dataset was perfectly balanced. Let us create another dummy example with an imbalance, adding two extra data points belonging to the negative class. For the sake of simplicity and to illustrate a quirk in the behavior of BCEWithLogitsLoss
, we will give those two extra points the same logits as the other data points in the negative class. It looks like this:
Get hands-on with 1400+ tech skills courses.