From 327afbc57b69bd57c3d07d6eeaea346bb6f2dc53 Mon Sep 17 00:00:00 2001 From: Ramin RX7 <52785580+Ramin-RX7@users.noreply.github.com> Date: Thu, 9 Feb 2023 16:26:56 +0330 Subject: [PATCH] Updated lineplot() arguments and minor text fixes --- 5-Clustering/2-K-Means/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/5-Clustering/2-K-Means/README.md b/5-Clustering/2-K-Means/README.md index 628ecbb1..875cfef4 100644 --- a/5-Clustering/2-K-Means/README.md +++ b/5-Clustering/2-K-Means/README.md @@ -163,7 +163,7 @@ Our score is **.53**, so right in the middle. This indicates that our data is no > 🎓 Inertia: K-Means algorithms attempt to choose centroids to minimize 'inertia', "a measure of how internally coherent clusters are."[source](https://scikit-learn.org/stable/modules/clustering.html). The value is appended to the wcss variable on each iteration. - > 🎓 k-means++: In [Scikit-learn](https://scikit-learn.org/stable/modules/clustering.html#k-means) you can use the 'k-means++' optimization, which "initializes the centroids to be (generally) distant from each other, leading to probably better results than random initialization. + > 🎓 k-means++: In [Scikit-learn](https://scikit-learn.org/stable/modules/clustering.html#k-means) you can use the 'k-means++' optimization, which "initializes the centroids to be (generally) distant from each other", leading to probably better results than random initialization. ### Elbow method @@ -173,7 +173,7 @@ Previously, you surmised that, because you have targeted 3 song genres, you shou ```python plt.figure(figsize=(10,5)) - sns.lineplot(range(1, 11), wcss,marker='o',color='red') + sns.lineplot(x=range(1, 11), y=wcss, marker='o', color='red') plt.title('Elbow') plt.xlabel('Number of clusters') plt.ylabel('WCSS') @@ -193,7 +193,7 @@ Previously, you surmised that, because you have targeted 3 song genres, you shou kmeans = KMeans(n_clusters = 3) kmeans.fit(X) labels = kmeans.predict(X) - plt.scatter(df['popularity'],df['danceability'],c = labels) + plt.scatter(df['popularity'], df['danceability'], c=labels) plt.xlabel('popularity') plt.ylabel('danceability') plt.show()