Regularized cost function and gradient.
Restored original lambda value in octave code for regularization.
Minimizing regularized cost function with scipy.optimize.fmin.