Hierarchical and DBSCAN
Clusters of varied shape and density.
Hierarchical and DBSCAN is a free Data Science Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Data Science Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Beyond k-Means
k-Means assumes round, similar-sized clusters and a fixed k. When that breaks, other algorithms handle trickier shapes and densities. 🔍
Build a Hierarchy
Hierarchical clustering merges the two closest groups over and over, building a tree of nested clusters from the bottom up.
Read the Dendrogram
That tree is drawn as a dendrogram. Cut it at a chosen height and the branches below become your clusters.
No k Up Front
A real perk is that you do not commit to k early. You inspect the dendrogram, then decide where to cut it.
Linkage Sets the Rule
How distance between groups is measured depends on the linkage, such as ward, average, or complete.
from sklearn.cluster import AgglomerativeClusteringA Density View
DBSCAN takes a different angle: it treats clusters as dense regions of points separated by sparser gaps.
Two Key Settings
DBSCAN needs a neighborhood radius eps and a minimum point count. Together they define what dense enough means.
from sklearn.cluster import DBSCAN
model = DBSCAN(eps=0.5, min_samples=5)It Finds the Count
Unlike k-Means, DBSCAN figures out the number of clusters itself from the density of your data.
Noise Gets Its Own Label
Points in sparse areas are flagged as noise with the label minus one, instead of being forced into a cluster.
Any Shape Welcome
Because it follows density, DBSCAN can trace long, curved, or oddly shaped clusters that k-Means would slice apart.
Pick Your Tool
Use hierarchical for nested structure you want to explore, and DBSCAN for irregular shapes with built-in outlier handling.
Quick Check
Let us confirm a standout trait of DBSCAN.
Recap
Hierarchical clustering builds a dendrogram you cut, while DBSCAN finds dense, any-shaped clusters and flags noise. 🎯
Frequently asked questions
Is the “Hierarchical and DBSCAN” lesson free?
Yes — the full text of “Hierarchical and DBSCAN” is free to read here on the web, and the Data Science Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Data Science Academy course, upgrade to CoddyKit PRO.
What will I learn in “Hierarchical and DBSCAN”?
Clusters of varied shape and density. You practise Data Science Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Data Science Academy?
No prior experience is required. Data Science Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Hierarchical and DBSCAN” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Data Science Academy lesson?
Yes. Every Data Science Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Supervised vs Unsupervised
- k-Means and Choosing k
- Hierarchical and DBSCAN
- Profile and Name Your Clusters