Implement full minibatch training