Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende The Weather Data and Linkages | Hierarchical Clustering
Cluster Analysis in Python
course content

Contenido del Curso

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.

Tarea

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.

Solución

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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 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.

Tarea

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.

Solución

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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Lamentamos que algo salió mal. ¿Qué pasó?
some-alt