Clustering is grouping (partitioning) a set of objects so that items in the same group are more similar to each other than to items in different groups, where the notion of similarity may be variously defined.

Clustering is a task of grouping (partitioning) a set of objects so that items in the same group are more similar (closer) to each other than to items in different groups. Often the notion of similarity is expressed as a distance measure, with greater distance conveying less similarity. The study of clustering algorithms (cluster analysis) originated in the social sciences but has become important in statistical data analysis (data mining) and in machine learning.

Examples of such algorithms are $K$-means and self-organizing map.