public static double separation(Clusterer clusterer, Cluster c1, Cluster c2) { return clusterer.distance(c1, c2); }
public static double cohesion(Clusterer clusterer, Cluster cluster) { double norm = cluster.size(); double cohesion = 0; for (Instance inst : cluster.getMembers()) { if (inst instanceof Cluster) { cohesion += cohesion(clusterer, (Cluster)inst); } else { cohesion += clusterer.distance(cluster, inst); } } return cohesion / norm; }