Skip to content

Commit

Permalink
clusterer: Update AgglomerativeClustering keyword to fix deprecation (#…
Browse files Browse the repository at this point in the history
…218)

Changes the keyword for the metric used to compute the linkage in sklearn.cluster.AgglomerativeClustering from `affinity`, which is deprecated in scikit-learn 1.2, to `metric`.

Behaviour should be identical.

See https://scikit-learn.org/stable/whats_new/v1.2.html#sklearn-cluster and https://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html
  • Loading branch information
EwoutH authored Dec 9, 2022
1 parent 4636fdb commit 3f98867
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ema_workbench/analysis/clusterer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def apply_agglomerative_clustering(distances, n_clusters, linkage="average"):
"""

c = cluster.AgglomerativeClustering(
n_clusters=n_clusters, affinity="precomputed", linkage=linkage
n_clusters=n_clusters, metric="precomputed", linkage=linkage
)
clusters = c.fit_predict(distances)
return clusters

0 comments on commit 3f98867

Please sign in to comment.