clustering basics beautified
No account is required. Learn the material, try the examples, and mark it complete locally when you are ready to move on.
Clustering Basics - Beginner Friendly Guide
This notebook introduces unsupervised learning using clustering algorithms.
Unlike supervised learning, clustering does not use labels. Instead, the goal is to discover natural groupings within the data.
In this notebook we will:
- Generate a synthetic dataset
- Visualize the dataset
- Apply K-Means Clustering
- Use the Elbow Method to choose the best number of clusters
- Apply Hierarchical (Agglomerative) Clustering
- Apply DBSCAN Clustering
- Compare clustering results
Libraries used:
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Scikit‑learn
Import Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering
from sklearn.cluster import DBSCAN
from sklearn.metrics import silhouette_score
sns.set_style("whitegrid")