Unbalanced classes in minibatches can cause problems. DL4J doesnt have build-in sollution so it is necessary to create one.