Ejemplo n.º 1
0
  public void calculate() {
    final int partitionCount = getPartitionsCount(documents);
    if (partitionCount == 0) {
      return;
    }

    int weightSum = 0;
    double contaminationSum = 0;

    for (Cluster cluster : clusters) {
      if (cluster.isOtherTopics()) {
        continue;
      }
      final double contamination = calculate(cluster, partitionCount);
      cluster.setAttribute(CONTAMINATION, contamination);

      contaminationSum += contamination * cluster.size();
      weightSum += cluster.size();
    }

    weightedAverageContamination = contaminationSum / weightSum;
  }
Ejemplo n.º 2
0
 public Double apply(Cluster cluster) {
   return cluster.isOtherTopics() ? 1.0 : -1.0;
 }