code: private static double dot(int[] x, double[] w) {
          double dot = w[w.length - 1];
  
          for (int i : x) {
              dot += w[i];
          }
  
          return dot;
      }
docs: Returns the dot product between weight vector and x (augmented with 1).