This is a very common problem. I wrote something in the FAQ which addresses it with a code example.
In a nut shell, when you train a supervised task on an unbalanced dataset, your model will optimize for decreasing loss, which can mean only answering the option that is the most common in the dataset.
To address this, we need to reweight those class indices and pass that set of weights into the loss function.
EDIT: I just reviewed the FAQ in the link and it seems that only addresses assessing an unbalanced dataset for model accuracy. I had later intended to include a function within it to calculate the rescaling weights, but it seems I never got around to that. I will update it in the next 24 hours to include that.