code: @Override
      public int predict(double[] x) {
          double minDist = Double.MAX_VALUE;
          int bestCluster = 0;
  
          int i = 0;
          for (Node neuron : nodes) {
              double dist = Math.squaredDistance(x, neuron.w);
              if (dist < minDist) {
                  minDist = dist;
                  bestCluster = i;
              }
              i++;
          }
  
          if (y == null || y.length != nodes.size()) {
              return bestCluster;
          } else {
  
              return y[bestCluster];
          }
      }
docs: Cluster a new instance to the nearest neuron.
  @param x a new instance.
  @return the cluster label. If the method partition() was called,
  this is the cluster id of nearest neuron. Otherwise, it is just
  the index of neuron.