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

Зміст курсу

Cluster Analysis in Python

Cluster Analysis in Python

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

book
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.

Завдання

Swipe to start coding

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Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 8
toggle bottom row

book
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.

Завдання

Swipe to start coding

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Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 8
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Ми дуже хвилюємося, що щось пішло не так. Що трапилося?
some-alt