Neural Clustering Processes

Ari Pakman, Yueqi Wang, Catalin Mitelut, Jin Hyung Lee, Liam Paninski

Introduction

Clustering is a fundamental task in machine learning, but performing it "the Bayesian way" is notoriously difficult. Standard probabilistic mixture models, such as Dirichlet Process Mixture Models, require posterior inference to determine which data point belongs to which cluster. Historically, researchers have faced a strict trade-off. Markov Chain Monte Carlo (MCMC) methods are highly accurate but painfully slow, often requiring thousands of iterations that fail to scale to large datasets. Conversely, Variational Inference (VI) is faster but often yields poor uncertainty estimates and struggles in "nonparametric" settings where the true number of clusters ($K$) is unknown.

To address this, recent work introduces Neural Clustering Processes (NCP), a deep learning framework for amortized Bayesian clustering. By investing computational time upfront to train a model on labeled samples from a generative process, NCPs can produce approximate posterior samples for new, unseen datasets almost instantaneously. Crucially, this method handles an arbitrary number of clusters and respects the mathematical symmetries (exchangeability) inherent in clustering tasks.

Methods: Two Approaches to Amortized Clustering

The authors propose two distinct neural architectures based on different ways to decompose the joint probability of cluster assignments. Both methods rely on Deep Sets-style architectures (using sum-pooling) to ensure the model remains invariant to the order in which data points are processed.

1. Neural Clustering Process (NCP)

The standard NCP utilizes a "pointwise" expansion. It predicts the cluster assignment of the $n$-th data point conditioned on the assignments of the previous $n-1$ points.

Pointwise expansion in NCP

To handle the dynamic nature of nonparametric clustering—where the number of clusters can grow as more data is observed—the authors introduce a Variable-input Softmax. The network's inputs are permutation-invariant representations of the points already assigned to each cluster, the global distribution of all clusters, and the remaining unassigned points.

2. Clusterwise Clustering Process (CCP)

Alternatively, the CCP expansion works by sampling one entire cluster at a time. It leverages a Variational Autoencoder (VAE) framework to model the distribution of clusters. This approach is significantly more efficient for large datasets because its computational complexity scales with the number of clusters $O(K)$ rather than the number of data points $O(N)$.

Key Insights and Results

A core philosophy of this work is treating symmetry as a first-class citizen. In clustering, labels like "Cluster 1" and "Cluster 2" are arbitrary. By utilizing sum-pooling and specific invariant encodings, the authors bake these exchangeability symmetries directly into the neural architecture. Furthermore, instead of searching for a "universal" clusterer, NCP learns the posterior of a specific generative process. If you can simulate data that mimics your problem domain, NCP can learn to invert that simulation.

Unlike K-means or standard deep clustering, NCP provides a full distribution over clusterings. If a data point lies ambiguously between two clusters, NCP will produce some samples where it belongs to Cluster A and others where it belongs to Cluster B, accurately reflecting the underlying uncertainty.

The models were rigorously evaluated across several domains:

  • 2D Gaussian Mixture Models: On synthetic data, NCP estimates matched the exact analytical posterior almost perfectly, passing rigorous "Geweke’s tests" for Bayesian consistency. Remarkably, the GPU-accelerated NCP produced over 100 independent posterior samples in the time it took a traditional Gibbs sampler to produce a single, correlated sample.
  • MNIST Digits: Tested on a Dirichlet Process Mixture Model where clusters consist of images of the same digit, proving the model's capability to handle high-dimensional image data.
  • Neural Spike Sorting: In a real-world scientific application involving high-density multielectrode array data, NCP outperformed state-of-the-art tools like Kilosort on low-signal-to-noise data. It successfully separated ambiguous small spikes that traditional methods often merge or ignore.

Limitations and Future Work

While powerful, the framework has limitations. The performance of NCP is inherently tied to the quality of the generative model used for training; significant deviations between real-world data and training simulations may bias posterior estimates. Additionally, while CCP scales efficiently at $O(K)$, the basic pointwise NCP scales at $O(N^2)$ or $O(NK)$, necessitating further architectural optimizations for datasets with millions of points. Finally, while the architecture respects many symmetries, strict "global" exchangeability is learned during training rather than mathematically guaranteed by the pointwise NCP architecture, presenting an avenue for future architectural refinements.

Summary updated

BibTeX
@inproceedings{pakman2020neural,
  author = {Ari Pakman and Yueqi Wang and Catalin Mitelut and Jin Hyung Lee and Liam Paninski},
  title = {{Neural Clustering Processes}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=8l9Qk9nvCB},
}
Figure