public double getIntraClusterDistance(
      DistanceMeasure measure, WhiBoCentroidClusterModel model, ExampleSet exampleSet) {

    double distanceSum = 0;
    int i = 0;
    for (Example example : exampleSet) {
      double distance =
          measure.calculateDistance(
              model.getCentroidCoordinates(i),
              getAsDoubleArray(example, exampleSet.getAttributes()));

      // da li se ovako radi za svaku meru?
      distanceSum += distance * distance;
      i++;
    }

    return distanceSum;
  }
  public double getMaxDistanceIndex(
      DistanceMeasure measure, WhiBoCentroidClusterModel model, ExampleSet exampleSet) {

    double maxDistanceSum = 0;
    int maxDistanceIndex = 0;

    int k = model.getNumberOfClusters();
    int exampleIndex = 0;
    for (Example example : exampleSet) {
      double distanceSum = 0;
      for (int l = 0; l < k; l++) {
        distanceSum +=
            measure.calculateDistance(
                model.getCentroidCoordinates(l),
                getAsDoubleArray(example, exampleSet.getAttributes()));
      }
      if (distanceSum > maxDistanceSum) {
        maxDistanceSum = distanceSum;
        maxDistanceIndex = exampleIndex;
      }
      exampleIndex++;
    }
    return maxDistanceIndex;
  }