1
$\begingroup$

I'm creating mini-batches to put into a CNN. Is it best to try and get an even mix of classes into each mini-batch (Scenario 1), or can this/should this be a random assortment of my classes (Scenario 2)?

Scenario 1:

  • I have 2 classes and a mini-batch size of 32. I should try and have 16 samples from each class in each mini-batch.

Scenario 2:

  • Same as 1, but I have a random distribution of samples in each mini-batch. So this could be 20 of one class and 12 of the other. Or even 32 of one class and none of the other on occasion.
$\endgroup$

2 Answers 2

0
$\begingroup$

Theoretically, it should not matter. As long as there are a large number of mini-batches and a good balance of classes within the training data.

$\endgroup$
0
$\begingroup$

If you use minibatch gradient descent , we should do random sampling. I think using just one class may lead to bias

$\endgroup$
1
  • $\begingroup$ Sure thing. However, say I had 200 minibatches its quite likely that a small number of these would contain only one class. But, you suspect random is better than ensuring each has an even split of classes? $\endgroup$ Commented Mar 4, 2022 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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