Spaces:
Running
Running
Spencer525
commited on
Commit
•
7f38fb4
1
Parent(s):
a2852d9
Update app.py
Browse files
app.py
CHANGED
@@ -88,15 +88,18 @@ if data_file is not None:
|
|
88 |
fig, ax = plt.subplots(1, 3, figsize=(15, 5))
|
89 |
ax = ax.flatten()
|
90 |
|
|
|
91 |
# K-means Clustering
|
92 |
if kmeans_model is not None:
|
93 |
kmeans = joblib.load(kmeans_model)
|
94 |
-
kmeans.set_params(n_clusters=kmeans_clusters)
|
95 |
kmeans_labels = kmeans.fit_predict(pca_data)
|
96 |
ax[0].scatter(pca_data[:, 0], pca_data[:, 1], c=kmeans_labels, cmap='viridis')
|
97 |
ax[0].set_title(f"K-means Clustering (n_clusters={kmeans_clusters})")
|
98 |
else:
|
99 |
ax[0].set_title("K-means Model Missing")
|
|
|
|
|
100 |
|
101 |
# Hierarchical Clustering
|
102 |
if hierarchical_model is not None:
|
|
|
88 |
fig, ax = plt.subplots(1, 3, figsize=(15, 5))
|
89 |
ax = ax.flatten()
|
90 |
|
91 |
+
|
92 |
# K-means Clustering
|
93 |
if kmeans_model is not None:
|
94 |
kmeans = joblib.load(kmeans_model)
|
95 |
+
kmeans.set_params(n_clusters=kmeans_clusters, n_init='auto') # Set n_init='auto' for newer versions of sklearn
|
96 |
kmeans_labels = kmeans.fit_predict(pca_data)
|
97 |
ax[0].scatter(pca_data[:, 0], pca_data[:, 1], c=kmeans_labels, cmap='viridis')
|
98 |
ax[0].set_title(f"K-means Clustering (n_clusters={kmeans_clusters})")
|
99 |
else:
|
100 |
ax[0].set_title("K-means Model Missing")
|
101 |
+
|
102 |
+
|
103 |
|
104 |
# Hierarchical Clustering
|
105 |
if hierarchical_model is not None:
|