It's a machine learning method where the model works with unlabeled data.
No output labels are given โ the algorithm tries to find patterns, structure, or groupings on its own.
Use Case:
Suppose you have customer data (age, purchase history, location), but no info on customer types.
Unsupervised learning will group similar customers โ without you telling it who is who.
Key Tasks in Unsupervised Learning:
1. Clustering
โ Group similar data points
โ Example: Customer segmentation
โ Algorithm: K-Means, Hierarchical Clustering
2. Dimensionality Reduction
โ Reduce features while preserving patterns
โ Helps in visualization & speeding up training
โ Algorithm: PCA (Principal Component Analysis), t-SNE
Example Dataset (Unlabeled):
| Age | Spending Score |
| --- | -------------- |
| 22 | 90 |
| 45 | 20 |
| 25 | 85 |
| 48 | 25 |
The model may group rows 1 & 3 as one cluster (young, high spenders) and rows 2 & 4 as another.
Python Code (K-Means):
from sklearn.cluster import KMeans
X = [[22, 90], [45, 20], [25, 85], [48, 25]]
model = KMeans(n_clusters=2)
model.fit(X)
print(model.labels_) # Output: [0 1 0 1] โ Two clusters
Summary:
โฆ No labels, only input features
โฆ Model discovers structure or patterns
โฆ Great for grouping, compression, and insights
Double Tap โฅ๏ธ For More