Commit 18a466c4 authored by Almouhannad Hafez's avatar Almouhannad Hafez

Add K-means clustering

parent 58ea70d5
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
"cluster_centers = pd.DataFrame(kmeans.cluster_centers_, columns=df.columns[:-1])\n", "cluster_centers = pd.DataFrame(kmeans.cluster_centers_, columns=df.columns[:-1])\n",
"\n", "\n",
"# Create and plot the heatmap\n", "# Create and plot the heatmap\n",
"plt.figure(figsize=(10, 8)) # Optional: adjust the figure size for better visibility\n", "plt.figure(figsize=(10, 8))\n",
"sns.heatmap(cluster_centers.T, cmap=\"YlGnBu\", linewidths=0.5, linecolor='green')\n", "sns.heatmap(cluster_centers.T, cmap=\"YlGnBu\", linewidths=0.5, linecolor='green')\n",
"num_clusters = len(cluster_centers)\n", "num_clusters = len(cluster_centers)\n",
"plt.xticks(ticks=range(num_clusters), labels=[i + 1 for i in range(num_clusters)], rotation=0)\n", "plt.xticks(ticks=range(num_clusters), labels=[i + 1 for i in range(num_clusters)], rotation=0)\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment