K-Means Clustering
Tags: #◇Computer Science #◇CSINTSY #◇K-Means Clustering #◇Problem Solving #◇M4
◇Overview
K-Means Clustering is an unsupervised machine learning algorithm designed to partition a dataset into distinct, non-overlapping groups (clusters) based on feature similarity. It is particularly effective with numerical features where distance metrics can be applied. The number of clusters is a hyperparameter that must be manually defined prior to running the algorithm.
Algorithm Steps:
- Decide the number of clusters, .
- Initialize random centroids.
- Assign each data point to the cluster of the nearest centroid (using Euclidean distance).
- Recompute the centroids by taking the mean of all points assigned to each cluster.
- Repeat steps 3 and 4 until convergence (i.e., until assignments no longer change).
Choosing :
A higher is not necessarily better. Strategies for selecting an appropriate include: Utilizing domain knowledge. The Elbow Method, where the model's Inertia is plotted against various values, and the "elbow" point is chosen as the optimal .
◇Important Formulas
Inertia (Within-Cluster Sum of Squares):
A metric to measure cluster quality (lower is better, meaning tighter clusters).
Where is cluster and is the centroid of .
◇Worked Examples
Algorithm Walkthrough:
Imagine a dataset with numerical features for temperature and humidity. Initialize random points in this 2D space. Calculate the Euclidean distance of all data points to these two centroids. Assign points to the closest centroid. Shift the centroids to the average position of their respective assigned points. Repeat the assignment and shifting until the centroids no longer move. The final groupings represent the clusters.
◇References & Navigation
- Previous Topic: ◇Naive Bayes
- Next Topic: ◇Expert Systems Overview
- Related Notes: ◇K Means Clustering, ◇Clustering
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
Which category of machine learning does K-Means Clustering belong to?
What is the primary role of the hyperparameter in the K-Means algorithm?
During the K-Means algorithm execution, how are data points assigned to clusters?
What does the "Inertia" (Within-Cluster Sum of Squares) metric measure in K-Means clustering?
How is the "Elbow Method" used to select the optimal number of clusters ?