Implementation of a hybrid gradient descent/incremental gradient method on least squares problems in MATLAB and neural networks in Python