Add weight decay term for cost computation.