# Can we say that clustering is a function?

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.

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.
• 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. Commented May 24, 2017 at 18:47