code: @Override
      public int predict(double[] x) {
          double minDist = Double.MAX_VALUE;
          int bestCluster = 0;
  
          for (Neuron neuron : neurons) {
              double dist = Math.squaredDistance(x, neuron.w);
              if (dist < minDist) {
                  minDist = dist;
                  bestCluster = neuron.y;
              }
          }
  
          return bestCluster;
      }
docs: Cluster a new instance to the nearest neuron. The method partition()
  should be called first.
  @param x a new instance.
  @return the cluster label of nearest neuron.