Esempio n. 1
0
    def test_calculate_global_overlap(self):
        distance_matrix = CondensedMatrix([1., 0.7, 2.,
                                               0.3, 1.,
                                                    0.7])

        decomposed_clusters = [{"traj_0":[0],"traj_1":[1]},{"traj_0":[2],"traj_1":[3]}]

        self.assertEqual(0., OverlapCalculator.calculate_global_overlap(decomposed_clusters, distance_matrix, 1, 1))

        decomposed_clusters = [{"traj_0":[0],"traj_1":[1]}, {"traj_0":[2]}, {"traj_1":[3]}]

        self.assertEqual(0., OverlapCalculator.calculate_global_overlap(decomposed_clusters, distance_matrix, 1, 1))
Esempio n. 2
0
 def analyze_clustering(cls, separated_decomposed_clusters, distance_matrix, analysis):
     analysis["total_num_clusters"] = 0
     analysis["total_num_elements"] = 0
     analysis["overlap"] = OverlapCalculator.calculate_global_overlap(mergeSeparatedClusters(separated_decomposed_clusters), distance_matrix, 2, 1)
     for cluster_type in separated_decomposed_clusters:
         analysis["num_" + cluster_type] = len(separated_decomposed_clusters[cluster_type])
         analysis["total_num_clusters"] += analysis["num_" + cluster_type]
         analysis["num_" + cluster_type + "_elements"] = numpy.sum([len(getAllElements(separated_decomposed_clusters[cluster_type][dc_id])) for dc_id in separated_decomposed_clusters[cluster_type]])
         analysis["total_num_elements"] += analysis["num_" + cluster_type + "_elements"]
     return cluster_type
Esempio n. 3
0
 def analyze_clustering(cls, separated_decomposed_clusters, distance_matrix,
                        analysis):
     analysis["total_num_clusters"] = 0
     analysis["total_num_elements"] = 0
     analysis["overlap"] = OverlapCalculator.calculate_global_overlap(
         mergeSeparatedClusters(separated_decomposed_clusters),
         distance_matrix, 2, 1)
     for cluster_type in separated_decomposed_clusters:
         analysis["num_" + cluster_type] = len(
             separated_decomposed_clusters[cluster_type])
         analysis["total_num_clusters"] += analysis["num_" + cluster_type]
         analysis["num_" + cluster_type + "_elements"] = numpy.sum([
             len(
                 getAllElements(
                     separated_decomposed_clusters[cluster_type][dc_id]))
             for dc_id in separated_decomposed_clusters[cluster_type]
         ])
         analysis["total_num_elements"] += analysis["num_" + cluster_type +
                                                    "_elements"]
     return cluster_type