Can we say that clustering is a function?

Of course, the term "clustering" is broad and can mean different things in different contexts: clustering as an area in machine learning, clustering algorithm, clustering mathematical method, etc.

But, can we talk about a clustering function? Like we can talk about classification function and regression function ...

I think we can, in the following sense. Clustering is a function with input: set of objects, and output: set of clusters, memberships in clusters for each object, and also relations between clusters (in case of hierarchical clustering).

Let me know what you think.


1 Answer 1


It absolutely is a function. Classically, for a set of datapoints $x_i$, clustering is a partition of $x_i$ (into clusters). So if we have $N$ clusters, $f$ maps $x_i$ to $\{1,2,\cdots,N\}$ which index clusters. The mapping is generally based on a distance function $d(x_i,x_j)$. There are some nice theoretical discussions here about how to axiomatize clustering and also the theoretical limitations of clustering.

  • $\begingroup$ Thank you. To add to my question. I was wondering if it is a function or not, because in general by function we mean a mapping that maps one thing to ONE other thing. And in clustering, it is not just the cluster mappings you mentioned, but also membership degrees for soft clustering, relations between clusters for hierarchical clustering. I mean, it seems there is more than just input to output mapping, and that is why i was wondering if i can call it a function. What you think about this? $\endgroup$
    – user162200
    Commented May 24, 2017 at 18:42
  • 2
    $\begingroup$ Well it depends on the kind of clustering. If you're just doing $k$ means it's absolutely just a function that maps each data point to a centroid. If it's soft clustering, then the function outputs a vector of cluster weights which convey membership degree to each cluster. If it's hierarchical, then it maps to a leaf node in a hierarchical tree of clusters. $\endgroup$
    – Alex R.
    Commented May 24, 2017 at 18:47
  • 1
    $\begingroup$ I'd rather map into sets instead of labels. There are clusterings where points can be in multiple clusters. $\endgroup$ Commented May 25, 2017 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.