ML assignment 4 - regularized gradient