Adding regularizer into the cost function