Adapting code from Andrew Ng’s Stanford Machine Learning course for neural network training.