From 5ab3aac4cd75bffc0b109805242c18322531e292 Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Mon, 16 Oct 2023 16:33:17 +0200 Subject: [PATCH] fix undefined name --- clustering/clustering.py | 4 ++-- sounds/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clustering/clustering.py b/clustering/clustering.py index ccee9b738..88f40cba0 100644 --- a/clustering/clustering.py +++ b/clustering/clustering.py @@ -103,7 +103,7 @@ def _average_mutual_information_reference_features_clusters(self, partition): Returns: Numpy.float: Average Mutual Information. """ - reference_features, clusters = self._prepare_clustering_result_and_reference_features_for_evaluation(classes) + reference_features, clusters = self._prepare_clustering_result_and_reference_features_for_evaluation(partition) return np.average(mutual_info_classif(reference_features, clusters, discrete_features=True)) def _silouhette_coeff_reference_features_clusters(self, partition): @@ -115,7 +115,7 @@ def _silouhette_coeff_reference_features_clusters(self, partition): Returns: Numpy.float: mean Silhouette Coefficient. """ - reference_features, clusters = self._prepare_clustering_result_and_reference_features_for_evaluation(classes) + reference_features, clusters = self._prepare_clustering_result_and_reference_features_for_evaluation(partition) return metrics.silhouette_score(reference_features, clusters, metric='euclidean') def _calinski_idx_reference_features_clusters(self, partition): diff --git a/sounds/models.py b/sounds/models.py index 70e6ad29b..2c89cf409 100644 --- a/sounds/models.py +++ b/sounds/models.py @@ -1684,7 +1684,7 @@ def get_pack_tags_bw(self): return self.pack_tags # If precomputed from PackManager.bulk_query_id method else: pack_tags_counts = get_search_engine().get_pack_tags(self.user.username, self.name) - return [{'name': tag, 'count': count, 'browse_url': browse_pack_tag_url(tag)} + return [{'name': tag, 'count': count, 'browse_url': self.browse_pack_tag_url(tag)} for tag, count in pack_tags_counts] except SearchEngineException as e: return []