Hi,

I am studying the LR / SGD code and I was wondering why in the iris test
case the first element of each vector is set to 1 in the loop parsing the
CSV file via v.set(0,1)

    for (String line : raw.subList(1, raw.size())) {
      // order gets a list of indexes
      order.add(order.size());

      // parse the predictor variables
      Vector v = new DenseVector(5);
      v.set(0, 1);
      int i = 1;
      Iterable<String> values = onComma.split(line);
      for (String value : Iterables.limit(values, 4)) {
        v.set(i++, Double.parseDouble(value));
      }
      data.add(v);

      // and the target
      target.add(dict.intern(Iterables.get(values, 4)));
    }

If I remove the line the accuracy drops to 92% but I don't know why this is
happening. Where is this first element used throughout the algorithm?

Cheers,

Frank

Reply via email to