Training neural networks efficiently using Keras