add regularized cost