Skip to content

Commit df7287d

Browse files
Fix AgglomerativeClustering error by replacing 'affinity' with 'metric' to fix CI Job issue.
1 parent b86069b commit df7287d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/clustering/sklearn_clustering_with_aeon_distances.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@
9292
"\n",
9393
"# Perform Agglomerative Clustering\n",
9494
"agg_clustering = AgglomerativeClustering(\n",
95-
" n_clusters=2, affinity=\"precomputed\", linkage=\"average\"\n",
95+
" n_clusters=2, metric=\"precomputed\", linkage=\"average\"\n",
9696
")\n",
9797
"labels = agg_clustering.fit_predict(distance_matrix)\n",
9898
"\n",
9999
"# Visualize the clustering results\n",
100100
"plt.figure(figsize=(10, 6))\n",
101101
"for label in np.unique(labels):\n",
102-
" plt.plot(X[labels == label].mean(axis=0), label=f\"Cluster {label}\")\n",
102+
" plt.plot(np.mean(X[labels == label], axis=0), label=f\"Cluster {label}\") # Fix indexing\n",
103103
"plt.title(\"Hierarchical Clustering with DTW Distance\")\n",
104104
"plt.legend()\n",
105-
"plt.show()"
105+
"plt.show()\n"
106106
]
107107
},
108108
{

0 commit comments

Comments
 (0)