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
Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:
- Import functions needed:
rand_scorefromsklearn.metrics.AgglomerativeClusteringfromsklearn.cluster.
- Create two models
model_completeandmodel_wardperforming a hierarchical clustering with 4 clusters both and'complete'and'ward'linkages respectively. - Fit the 3-14 columns of
datato models and predict the labels. Save the labels formodel_completewithinlabels_completeand formodel_wardwithinlabels_ward. - Compute the rand index using
labels_completeandlabels_ward.
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Génial!
Completion taux amélioré à 3.57
How Similar are the Results?
Glissez pour afficher le menu
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
Compute the rand index to compare the results of using complete and ward linkages. Follow the next steps:
- Import functions needed:
rand_scorefromsklearn.metrics.AgglomerativeClusteringfromsklearn.cluster.
- Create two models
model_completeandmodel_wardperforming a hierarchical clustering with 4 clusters both and'complete'and'ward'linkages respectively. - Fit the 3-14 columns of
datato models and predict the labels. Save the labels formodel_completewithinlabels_completeand formodel_wardwithinlabels_ward. - Compute the rand index using
labels_completeandlabels_ward.
Solution
Merci pour vos commentaires !
single