Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Case 2: Four Distinct Clusters | K-Means Algorithm
Cluster Analysis in Python
course content

Contenu du cours

Cluster Analysis in Python

Cluster Analysis in Python

1. K-Means Algorithm
2. K-Medoids Algorithm
3. Hierarchical Clustering
4. Spectral Clustering

book
Case 2: Four Distinct Clusters

Well, I think that the model did good work. But what if we try to divide the points into 4 groups?

Tâche

Swipe to start coding

  1. Import necessary libraries with their standard aliases. These are pandas (pd), matplotlib.pyplot (plt), seaborn (sns), and KMeans from sklearn.cluster.
  2. Create a KMeans model object with 4 clusters.
  3. Fit the data to the model.
  4. Predict the labels for data. Save the result within the 'prediction' column of data.
  5. Build scatter plot for 'x' and 'y' columns of data with each point being painted with respect to the 'prediction' column.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 5
toggle bottom row

book
Case 2: Four Distinct Clusters

Well, I think that the model did good work. But what if we try to divide the points into 4 groups?

Tâche

Swipe to start coding

  1. Import necessary libraries with their standard aliases. These are pandas (pd), matplotlib.pyplot (plt), seaborn (sns), and KMeans from sklearn.cluster.
  2. Create a KMeans model object with 4 clusters.
  3. Fit the data to the model.
  4. Predict the labels for data. Save the result within the 'prediction' column of data.
  5. Build scatter plot for 'x' and 'y' columns of data with each point being painted with respect to the 'prediction' column.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 5
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Nous sommes désolés de vous informer que quelque chose s'est mal passé. Qu'est-il arrivé ?
some-alt