Assessing Hierarchical Clustering Models with Scikit-learn Metrics
Introduction
Welcome to today's discussion on Hierarchical Clustering. We will be studying its effectiveness using the Silhouette Score, the Davies-Bouldin Index, and Cross-Tabulation Analysis. We will utilize Python's powerful libraries, scikit-learn and pandas, to equip you with practical and useful skills for evaluating clustering models.
Hierarchical Clustering and Scikit-learn Introduction
Scikit-learn is a widely used Python library for machine learning. In this lesson, we will be using its powerful built-in methods, including the silhouette_score and davies_bouldin_score. Additionally, we will implement Hierarchical Clustering from scikit-learn on some data:
This function applies Hierarchical Clustering to our dataset. The formed cluster labels can be accessed via clustering.labels_.
Silhouette Score
The Silhouette Score offers a measure to evaluate the effectiveness of our clustering. This score gauges how similar a point is to its own cluster compared to other clusters. Higher scores indicate better clustering.
We will implement the silhouette_score function from the sklearn library on our data:
The output provides a single score showing the effectiveness of our clustering.
Davies-Bouldin Index
The Davies-Bouldin index evaluates the average similarity between clusters. It bears an inverse relationship to model performance, meaning that a lower index value indicates a better model.
We will use the davies_bouldin_score function in sklearn as follows:
The Davies-Bouldin Index thus obtained serves as another measure of our clustering effectiveness.
Visualizing and Assessing Clustered Data

