Cookie Consent
Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.
Read our Privacy Policy

Clustering Algorithms

Clustering algorithms are a category of unsupervised machine learning algorithms used to partition a given dataset into clusters, or groups. The main goal of these algorithms is to identify and group similar instances, such that the instances within the same cluster are more similar to each other than the instances in other clusters. These algorithms are used to explore, analyze, and find patterns and structures in unlabeled data.

How Clustering Algorithms work

Clustering algorithms work by defining a measure of similarity which is used to classify the data into clusters. These measures of similarity vary depending on the type of data and the specific algorithm being used.

The process begins with the algorithm randomly selecting a point from the dataset to serve as the initial centroid for each cluster. Then, the remaining points are assigned to the closest (based on the defined measure of similarity/distance) centroid, thus forming clusters. The centroids are then recalculated as the mean value of all the points belonging to each cluster.

This process of re-assigning points to clusters and recalculating centroids is repeated until some stopping criterion is met. The stopping criteria could be things like no change in the membership of clusters, the centroids remain the same, a maximum number of iterations reached, or a satisfactory similarity measure threshold is achieved.

Some popular types of clustering algorithms include K-means, DBSCAN, Hierarchical clustering, Gaussian Mixture Models, and Mean-Shift Clustering, all of which have different approaches to defining similarity and forming clusters.

Lakera LLM Security Playbook
Learn how to protect against the most common LLM vulnerabilities

Download this guide to delve into the most common LLM security risks and ways to mitigate them.

Related terms
untouchable mode.
Get started for free.

Lakera Guard protects your LLM applications from cybersecurity risks with a single line of code. Get started in minutes. Become stronger every day.

Join our Slack Community.

Several people are typing about AI/ML security. 
Come join us and 1000+ others in a chat that’s thoroughly SFW.