Calculate cost function now computes regularization term.