This one is based on the ES-project but this time I use gradient descent instead of evolution strategy.
Evolution strategy randomly modifies the coefficients. That is why it can take a long time until a local optimization is found.
It's possible that gradient descent gets stuck in a local minimum. You can identify this by the fact that the sum of the changes of the theta values is quite small.
Install Octave on a Mac with Homebrew Cask:
brew tap octave-app/octave-app
brew cask install octave-app