regularized cost function has been implemented