Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen K-Medoids and the Weather Data | K-Medoids Algorithm
Cluster Analysis in Python
course content

Kursinhalt

Cluster Analysis in Python

Cluster Analysis in Python

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

book
K-Medoids and the Weather Data

As you can see, there was no such clear peek as in the example. That means that both 3 and 4 clusters may be a good choice!

Let's see what will be the result of using the K-Medoids algorithm for the weather data we used in the previous section. Let's start with defining the optimal number of clusters.

Aufgabe

Swipe to start coding

Given cities' average temperatures dataset data. The numerical columns are 3 - 14. Table

Your tasks are:

  1. Using for loop iterate over n_cl. Within the loop:
  • Create KMedoids model with j clusters named model.
  • Fit the 2-15 columns of data to the model. Watch out that indices in Python start from 0.
  • Add silhouette score value to the silhouettes list. Remember to pass two parameters: the data used for fitting (the same 3-15 columns) and predicted by model labels.
  1. Visualize the results using lineplot of sns. Pass n_cl as x parameter and silhouettes as y. Do not forget to apply the .show() method to display the plot.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 4
toggle bottom row

book
K-Medoids and the Weather Data

As you can see, there was no such clear peek as in the example. That means that both 3 and 4 clusters may be a good choice!

Let's see what will be the result of using the K-Medoids algorithm for the weather data we used in the previous section. Let's start with defining the optimal number of clusters.

Aufgabe

Swipe to start coding

Given cities' average temperatures dataset data. The numerical columns are 3 - 14. Table

Your tasks are:

  1. Using for loop iterate over n_cl. Within the loop:
  • Create KMedoids model with j clusters named model.
  • Fit the 2-15 columns of data to the model. Watch out that indices in Python start from 0.
  • Add silhouette score value to the silhouettes list. Remember to pass two parameters: the data used for fitting (the same 3-15 columns) and predicted by model labels.
  1. Visualize the results using lineplot of sns. Pass n_cl as x parameter and silhouettes as y. Do not forget to apply the .show() method to display the plot.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 4
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
Wir sind enttäuscht, dass etwas schief gelaufen ist. Was ist passiert?
some-alt