docs: @Override
      public void trainOnInstanceImpl(Instance instance) {
  
          if (m_weights == null) {
              m_weights = new double[instance.numAttributes() + 1];
          }
          if (!instance.classIsMissing()) {
  
              double learningRate = 1.0 / (m_lambda * m_t);
              //double scale = 1.0 - learningRate * m_lambda;
              double scale = 1.0 - 1.0 / m_t;
              double y = (instance.classValue() == 0) ? -1 : 1;
              double wx = dotProd(instance, m_weights, instance.classIndex());
              double z = y * (wx + m_weights[m_weights.length - 1]);
  
              for (int j = 0; j < m_weights.length - 1; j++) {
                  if (j != instance.classIndex()) {
                      m_weights[j] *= scale;
                  }
              }
  
              if (m_loss == LOGLOSS || (z < 1)) {
                  double loss = dloss(z);
                  int n1 = instance.numValues();
                  for (int p1 = 0; p1 < n1; p1++) {
                      int indS = instance.index(p1);
                      if (indS != instance.classIndex() && !instance.isMissingSparse(p1)) {
                          double m = learningRate * loss * (instance.valueSparse(p1) * y);
                          m_weights[indS] += m;
                      }
                  }
  
                  // update the bias
                  m_weights[m_weights.length - 1] += learningRate * loss * y;
              }
  
              double norm = 0;
              for (int k = 0; k < m_weights.length - 1; k++) {
                  if (k != instance.classIndex()) {
                      norm += (m_weights[k] * m_weights[k]);
                  }
              }
  
              double scale2 = Math.min(1.0, (1.0 / (m_lambda * norm)));
              if (scale2 < 1.0) {
                  scale2 = Math.sqrt(scale2);
                  for (int j = 0; j < m_weights.length - 1; j++) {
                      if (j != instance.classIndex()) {
                          m_weights[j] *= scale2;
                      }
                  }
              }
              m_t++;
          }
      }