in samoa-api/src/main/java/org/apache/samoa/evaluation/measures/CMM_GTAnalysis.java [640:687]
private void calculateGTClusterConnections() {
for (int c0 = 0; c0 < gt0Clusters.size(); c0++) {
for (int c1 = 0; c1 < gt0Clusters.size(); c1++) {
gt0Clusters.get(c0).calculateClusterConnection(c1, true);
}
}
boolean changedConnection = true;
while (changedConnection) {
if (debug) {
System.out.println("Cluster Connection");
for (int c = 0; c < gt0Clusters.size(); c++) {
System.out.print("C" + gt0Clusters.get(c).label + " --> ");
for (int c1 = 0; c1 < gt0Clusters.get(c).connections.size(); c1++) {
System.out.print(" C" + gt0Clusters.get(c1).label + ": " + gt0Clusters.get(c).connections.get(c1));
}
System.out.println("");
}
System.out.println("");
}
double max = 0;
int maxIndexI = -1;
int maxIndexJ = -1;
changedConnection = false;
for (int c0 = 0; c0 < gt0Clusters.size(); c0++) {
for (int c1 = c0 + 1; c1 < gt0Clusters.size(); c1++) {
if (c0 == c1)
continue;
double min = Math.min(gt0Clusters.get(c0).connections.get(c1), gt0Clusters.get(c1).connections.get(c0));
if (min > max) {
max = min;
maxIndexI = c0;
maxIndexJ = c1;
}
}
}
if (maxIndexI != -1 && max > tauConnection) {
gt0Clusters.get(maxIndexI).mergeCluster(maxIndexJ);
if (debug)
System.out.println("Merging " + maxIndexI + " and " + maxIndexJ + " because of connection " + max);
changedConnection = true;
}
}
numGT0Classes = gt0Clusters.size();
}