Sección 2. Capítulo 4
single
K-Medoids and the Weather Data
Desliza para mostrar el menú
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.
Tarea
Desliza para comenzar a programar
Given cities' average temperatures dataset data. The numerical columns are 3 - 14.

Your tasks are:
- Using
forloop iterate overn_cl. Within the loop:
- Create
KMedoidsmodel withjclusters namedmodel. - Fit the 2-15 columns of
datato the model. Watch out that indices in Python start from 0. - Add silhouette score value to the
silhouetteslist. Remember to pass two parameters: the data used for fitting (the same 3-15 columns) and predicted bymodellabels.
- Visualize the results using
lineplotofsns. Passn_clasxparameter andsilhouettesasy. Do not forget to apply the.show()method to display the plot.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 4
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla