Skip to content

Commit

Permalink
refactor: run duty format
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanschild committed Dec 18, 2023
1 parent 51769fb commit 0a45597
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,9 @@ def _get_the_two_clostest_clusters(self) -> Optional[Tuple[int, int]]:
"cluster_ID1": cluster_ID1,
"cluster_ID2": cluster_ID2,
"distance": self._get_distance(cluster_IDi=cluster_ID1, cluster_IDj=cluster_ID2),
"merged_size": len(self.clusters_storage[cluster_ID1].members)
+ len(self.clusters_storage[cluster_ID2].members)
"merged_size": len(self.clusters_storage[cluster_ID1].members) + len(
self.clusters_storage[cluster_ID2].members
),
# TODO : Choose between "distance then size(count)" and "size_type(boolean) then distance"
}
for cluster_ID1 in self.current_clusters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def compute_clusters_frequency(clustering_result: Dict[str, int]) -> Dict[int, f

# Compute frequency of clusters in `clustering_result`.
frequence_of_clusters: Dict[int, float] = {
cluster_ID: len([data_ID for data_ID in clustering_result if clustering_result[data_ID] == cluster_ID])
/ nb_of_data_IDs
cluster_ID: (
len([data_ID for data_ID in clustering_result if clustering_result[data_ID] == cluster_ID]) / nb_of_data_IDs
)
for cluster_ID in list_of_possible_cluster_IDs
}

Expand Down

0 comments on commit 0a45597

Please sign in to comment.