Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Visualizing the Dynamics Across Clusters | K-Means 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

Visualizing the Dynamics Across Clusters

The selective pair of months on the scatter plot looked good, didn't it? Maybe there were no key differences between 'areas' on the plot, but at least there were no outliers outside the respective groups, and in general, all groups were disjoint.

Finally, let's find out the yearly dynamics for each cluster, i.e. let's build the line plot representing the monthly averages for each group of points.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 8
toggle bottom row

Visualizing the Dynamics Across Clusters

The selective pair of months on the scatter plot looked good, didn't it? Maybe there were no key differences between 'areas' on the plot, but at least there were no outliers outside the respective groups, and in general, all groups were disjoint.

Finally, let's find out the yearly dynamics for each cluster, i.e. let's build the line plot representing the monthly averages for each group of points.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 1. Capítulo 8
toggle bottom row

Visualizing the Dynamics Across Clusters

The selective pair of months on the scatter plot looked good, didn't it? Maybe there were no key differences between 'areas' on the plot, but at least there were no outliers outside the respective groups, and in general, all groups were disjoint.

Finally, let's find out the yearly dynamics for each cluster, i.e. let's build the line plot representing the monthly averages for each group of points.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

The selective pair of months on the scatter plot looked good, didn't it? Maybe there were no key differences between 'areas' on the plot, but at least there were no outliers outside the respective groups, and in general, all groups were disjoint.

Finally, let's find out the yearly dynamics for each cluster, i.e. let's build the line plot representing the monthly averages for each group of points.

Tarefa

Table
  1. Extract the necessary columns (month's names and temperatures) within the col variable:
  • Firstly, extract the 2-13 column names as list type, and save them within the col variable.
  • Then add the 'prediction' string to the list col.
  1. Calculate the monthly average temperatures for each cluster, and save the result within monthly_data variable:
  • Firstly group the observations of col column of data by 'prediction'.
  • Then calculate .mean() of grouped table.
  • Then apply .stack() to stack the table (already done).
  • Finally reset the indices using .reset_index() method.
  1. Assign list ['Group', 'Month', 'Temp'] as column names for transformed data within monthly_data variable.
  2. Build the line plot 'Month' vs 'Temp' for each Group using monthly_data DataFrame.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 8
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt