code: function regularizeL2(weights, gradientCount, stepSize, regParam) {
    const [gradient, count] = gradientCount;
  
    for (let i = 0; i < gradient.length; i++) {
      let grad = (gradient[i] || 0) / count;
      weights[i] = weights[i] || 0;
      weights[i] -= stepSize * (grad + regParam * weights[i]);
    }
  }
docs: L2, a.k.a ridge regression