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

Conteúdo do Curso

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.

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 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.

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 4
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Sentimos muito que algo saiu errado. O que aconteceu?
some-alt