Added regularization for cost and gradient (X and Theta)