code: @Override
      public int predict(double[] x) {
          double best = Double.MAX_VALUE;
          int ii = -1, jj = -1;
          for (int i = 0; i < height; i++) {
              for (int j = 0; j < width; j++) {
                  double dist = Math.squaredDistance(neurons[i][j], x);
                  if (dist < best) {
                      best = dist;
                      ii = i;
                      jj = j;
                  }
              }
          }
          
          if (y == null) {
              return ii * width + jj;
          } else {
              return y[ii * width + jj];
          }
      }
docs: Cluster a new instance to the nearest neuron. For clustering purpose,
  one should build a sufficient large map to capture the structure of
  data space. Then the neurons of map can be clustered into a small number
  of clusters. Finally the sample should be assign to the cluster of
  its nearest neurons.
  
  @param x a new instance.
  @return the cluster label. If the method {@link #partition(int)} is
  called before, this is the cluster label of the nearest neuron.
  Otherwise, this is the index of neuron (i * width + j).