code: private void calculateMean() {
          for (Tuple t : trainingData) {
              int index = model.labelIndexer.getIndex(t.label);
              count[index]++;
              model.meanVectors[index] = VectorUtils.addition(model.meanVectors[index], t.vector.getVector());
  //                    VectorUtils.zip(model.meanVectors[index], t.vector.getVector(), (x, y) -> x + y); // Performance
          }
  
          for (int i = 0; i < model.meanVectors.length; i++) {
              // Get each label and normalize
              double[] meanVector = model.meanVectors[i]; // feat(label)
              VectorUtils.scale(meanVector, 1.0 / count[i]);
              model.meanVectors[i] = meanVector;
          }
  
          for (int i = 0; i < model.meanVectors.length; i++) {
              for (int j = 0; j < model.meanVectors[i].length; j++) {
                  if (model.meanVectors[i][j] == 0) {
                      LOG.warn("mean is 0 for label " + model.labelIndexer.labelIndexer.inverse().get(i) + " at dimension " + j);
                      model.meanVectors[i][j] = Double.MIN_VALUE;
                  }
              }
          }
      }
docs: Step 1