Ejemplo n.º 1
0
 def max_intercluster_distance(cls, clustering, matrix):
     """
     Calculates d_max, the maximum inter clusters.
     @param clustering: The clustering being checked.
     @param matrix: The condensed matrix containing all distances.
     @return: d_max' value
     """
     distances = []
     for i in range(len(clustering.clusters) - 1):
         for j in range(i + 1, len(clustering.clusters)):
             distances.extend(get_inter_cluster_distances(i, j, clustering.clusters, matrix))
     return numpy.max(distances)
Ejemplo n.º 2
0
 def max_intercluster_distance(cls, clustering, matrix):
     """
     Calculates d_max, the maximum inter clusters.
     @param clustering: The clustering being checked.
     @param matrix: The condensed matrix containing all distances.
     @return: d_max' value
     """
     distances = []
     for i in range(len(clustering.clusters) - 1):
         for j in range(i + 1, len(clustering.clusters)):
             distances.extend(
                 get_inter_cluster_distances(i, j, clustering.clusters,
                                             matrix))
     return numpy.max(distances)
Ejemplo n.º 3
0
 def test_get_inter_cluster_distances(self):
     matrix = CondensedMatrix(squared_CH_table1)
     clusters = [Cluster(None, [1,2]),Cluster(None, [3,4]), Cluster(None, [5])]
     numpy.testing.assert_equal(get_inter_cluster_distances(0, 1, clusters, matrix), [6.0, 13.0, 6.0, 17.0])
     numpy.testing.assert_equal(get_inter_cluster_distances(1, 2, clusters, matrix), [15.0, 6.0])
     numpy.testing.assert_equal(get_inter_cluster_distances(0, 2, clusters, matrix), [15.0, 21.0])