Implement L1 & L2 regularization.