Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
How Similar are the Results? | Hierarchical Clustering
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

How Similar are the Results?

Well done! Let's look at the last line charts you built in the previous chapter.

As you can see, only the ward linkage could catch the 'downward up to July' trend. Both results are different. But let's find out how different they are using the rand index.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 8
toggle bottom row

How Similar are the Results?

Well done! Let's look at the last line charts you built in the previous chapter.

As you can see, only the ward linkage could catch the 'downward up to July' trend. Both results are different. But let's find out how different they are using the rand index.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 3. Chapter 8
toggle bottom row

How Similar are the Results?

Well done! Let's look at the last line charts you built in the previous chapter.

As you can see, only the ward linkage could catch the 'downward up to July' trend. Both results are different. But let's find out how different they are using the rand index.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Well done! Let's look at the last line charts you built in the previous chapter.

As you can see, only the ward linkage could catch the 'downward up to July' trend. Both results are different. But let's find out how different they are using the rand index.

Task

Table

Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:

  1. Import functions needed:
  • rand_score from sklearn.metrics.
  • AgglomerativeClustering from sklearn.cluster.
  1. Create two models model_complete and model_ward performing a hierarchical clustering with 4 clusters both and 'complete' and 'ward' linkages respectively.
  2. Fit the 3-14 columns of data to models and predict the labels. Save the labels for model_complete within labels_complete and for model_ward within labels_ward.
  3. Compute the rand index using labels_complete and labels_ward.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 8
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt