Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add metric argument to allow for other linkages #222

Merged
merged 6 commits into from
Mar 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ema_workbench/analysis/clusterer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def plot_dendrogram(distances):
return fig


def apply_agglomerative_clustering(distances, n_clusters, linkage="average"):
def apply_agglomerative_clustering(distances, n_clusters, metric="precomputed", linkage="average"):
"""apply agglomerative clustering to the distances

Parameters
Expand All @@ -99,8 +99,6 @@ def apply_agglomerative_clustering(distances, n_clusters, linkage="average"):

"""

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