Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre The Weather Data and Linkages | Hierarchical Clustering
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
The Weather Data and Linkages

Let's see how will the dendrograms with different linkage parameter values will look like for the weather data.

Note, that to explore the task's result you will need to scroll over the output block on the right and below.

Tâche

Swipe to start coding

Table

For the weather data stored in the data variable build the dendrograms for each of 4 types of linkage ('single', 'average', 'complete', and 'ward'. These are already stored in the linkages list). Follow the next steps:

  1. Import the functions needed:
  • AgglomerativeClustering from sklearn.cluster.
  • dendrogram and linkage from scipy.cluster.hierarchy.
  1. Iterate over the linkages list using the dummy variable link.
  2. Within the dist variable compute the distances using 3-14 (these are positions, not indices!) columns of data, and passing the method parameter to link.
  3. Build the dendrogram for dist, setting no_labels to True.

Solution

Note, that you received four dendrograms in the console. To explore them scroll the console down.

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 3. Chapitre 5
toggle bottom row

book
The Weather Data and Linkages

Let's see how will the dendrograms with different linkage parameter values will look like for the weather data.

Note, that to explore the task's result you will need to scroll over the output block on the right and below.

Tâche

Swipe to start coding

Table

For the weather data stored in the data variable build the dendrograms for each of 4 types of linkage ('single', 'average', 'complete', and 'ward'. These are already stored in the linkages list). Follow the next steps:

  1. Import the functions needed:
  • AgglomerativeClustering from sklearn.cluster.
  • dendrogram and linkage from scipy.cluster.hierarchy.
  1. Iterate over the linkages list using the dummy variable link.
  2. Within the dist variable compute the distances using 3-14 (these are positions, not indices!) columns of data, and passing the method parameter to link.
  3. Build the dendrogram for dist, setting no_labels to True.

Solution

Note, that you received four dendrograms in the console. To explore them scroll the console down.

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 3. 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