Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Mean Yearly Temperatures Across Clusters | K-Medoids Algorithm
Cluster Analysis in Python
course content

Course Content

Cluster Analysis in Python

Cluster Analysis in Python

1. K-Means Algorithm
2. K-Medoids Algorithm
3. Hierarchical Clustering
4. Spectral Clustering

bookMean Yearly Temperatures Across Clusters

The last chart we got was even harder to interpret than two chapters ago. But if we are talking about 'peeks', the number 4 best fits it.

Let's compare the yearly average temperatures across 4 predicted clusters.

Task

Calculate the yearly average temperatures across each cluster. The structure of data is shown below. [object Object]

Follow the next steps:

  1. Create a KMedoids model with 4 clusters named model.
  2. Fit the 3-15 (these are positions, not indices) columns of data to model.
  3. Add the 'prediction' column to data with predicted by model labels.
  4. Group the data DataFrame by the prediction column, then apply the .mean() function twice: the first call will calculate the monthly means, the second one (with axis = 1) will calculate the yearly averages.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 5
toggle bottom row

bookMean Yearly Temperatures Across Clusters

The last chart we got was even harder to interpret than two chapters ago. But if we are talking about 'peeks', the number 4 best fits it.

Let's compare the yearly average temperatures across 4 predicted clusters.

Task

Calculate the yearly average temperatures across each cluster. The structure of data is shown below. [object Object]

Follow the next steps:

  1. Create a KMedoids model with 4 clusters named model.
  2. Fit the 3-15 (these are positions, not indices) columns of data to model.
  3. Add the 'prediction' column to data with predicted by model labels.
  4. Group the data DataFrame by the prediction column, then apply the .mean() function twice: the first call will calculate the monthly means, the second one (with axis = 1) will calculate the yearly averages.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 5
toggle bottom row

bookMean Yearly Temperatures Across Clusters

The last chart we got was even harder to interpret than two chapters ago. But if we are talking about 'peeks', the number 4 best fits it.

Let's compare the yearly average temperatures across 4 predicted clusters.

Task

Calculate the yearly average temperatures across each cluster. The structure of data is shown below. [object Object]

Follow the next steps:

  1. Create a KMedoids model with 4 clusters named model.
  2. Fit the 3-15 (these are positions, not indices) columns of data to model.
  3. Add the 'prediction' column to data with predicted by model labels.
  4. Group the data DataFrame by the prediction column, then apply the .mean() function twice: the first call will calculate the monthly means, the second one (with axis = 1) will calculate the yearly averages.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

The last chart we got was even harder to interpret than two chapters ago. But if we are talking about 'peeks', the number 4 best fits it.

Let's compare the yearly average temperatures across 4 predicted clusters.

Task

Calculate the yearly average temperatures across each cluster. The structure of data is shown below. [object Object]

Follow the next steps:

  1. Create a KMedoids model with 4 clusters named model.
  2. Fit the 3-15 (these are positions, not indices) columns of data to model.
  3. Add the 'prediction' column to data with predicted by model labels.
  4. Group the data DataFrame by the prediction column, then apply the .mean() function twice: the first call will calculate the monthly means, the second one (with axis = 1) will calculate the yearly averages.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 2. Chapter 5
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt