code: function hingeLoss(p, weights) {
    const [label, features] = p;
    const grad = [];
    let dotProd = 0;
  
    for (let i = 0; i < features.length; i++)
      dotProd += (features[i] || 0) * (weights[i] || 0);
  
    if (label * dotProd < 1)
      for (let i = 0; i < features.length; i++)
        grad[i] = -label * (features[i] || 0);
    else
      for (let i = 0; i < features.length; i++)
        grad[i] = 0;
  
    return grad;
  }
docs: TODO #2: for each regularizer: set weight to 0 if regularization crosses 0 (sign change), to achieve feature selection (sparse models)