function loss_with_l2(predictions, actuals, weights, lambda_):

   data_loss = mean_squared_error(predictions, actuals)
   penalty = lambda_ * sum(w ** 2 for w in weights) # discourages large weight
 s
   return data_loss + penalty
 # other tools: dropout (randomly disable neurons during training), early stopping
