Abstract
Bayesian Nonparametric (BNP) models, such as the Chinese Restaurant Process (CRP), provide a powerful framework for clustering data when the number of groups is unknown. However, traditional inference methods are often offline and scale quadratically with the number of observations. We present the Recursive Chinese Restaurant Process (R-CRP), a novel Bayesian filtering algorithm that achieves quasilinear time complexity ($O(t \log t)$) and logarithmic space complexity ($O(\log t)$). By approximating the history of observations as a recursive running sum of previous posteriors, R-CRP enables efficient online inference for streaming data while maintaining accuracy competitive with traditional offline methods.
Introduction
In many real-world streaming data applications—ranging from biological species identification to real-time document clustering—data arrives sequentially, and the total number of underlying categories is unknown. The Chinese Restaurant Process (CRP) is the gold standard BNP prior for such "infinite" clustering problems. Despite its flexibility, standard inference tools like Markov Chain Monte Carlo (MCMC) or Variational Inference (VI) typically require multiple passes over the entire dataset, making them unusable for long-running data streams.
The primary challenge lies in the $O(t^2)$ scaling of standard BNP methods. To address this, we propose a "filter" approach: an algorithm that processes each data point exactly once, updates its internal state, and moves on without needing to re-examine the past, satisfying the requirements for true online processing.
The Recursive Chinese Restaurant Process (R-CRP)
The core innovation of R-CRP is the replacement of the history-dependent conditional distribution in a standard CRP with a recursively updated marginal distribution. In a standard CRP, the assignment of the $t$-th data point depends on the specific assignments of all $t-1$ previous points. R-CRP breaks this dependence by maintaining a running sum of the posteriors of previous latent states.
The algorithm functions similarly to a Kalman filter for clustering. It tracks two primary components recursively:
- Running Sum of Posteriors: Instead of storing every past assignment, the model aggregates the probability mass assigned to each cluster over time.
- Table Count Distribution: It computes the posterior distribution over the number of non-empty clusters ($K_t$), which is essential for determining the probability of spawning a brand-new cluster.
This aggregation allows the model to estimate the "latent prior" for the current observation without re-examining the past, leading to significant gains in computational efficiency.
Experimental Evaluation
We evaluated R-CRP across three diverse datasets to test its robustness and accuracy:
- Synthetic Gaussian Mixture Models (GMM): Used to verify centroid recovery and label accuracy in a controlled environment.
- Omniglot: A dataset of 1,623 handwritten characters. Images were processed through a Variational Autoencoder (VAE) to create low-dimensional vectors for clustering.
- Categorical Mixture Model: A text-like dataset using discrete word counts to test performance with non-Gaussian likelihoods.
Results and Discussion
R-CRP demonstrates a favorable balance between speed and accuracy. On the Omniglot and GMM benchmarks, it achieved higher Adjusted Mutual Information (AMI) than other online baselines like Online CRP and Sequential Unconstrained Gibbs Sampling (SUGS). Its performance remained comparable to expensive, multi-pass offline MCMC methods.
Crucially, R-CRP scales quasilinearly. While slightly slower than simple point-estimate heuristics like DP-Means, it provides a full posterior distribution, offering richer uncertainty quantification. In categorical models, R-CRP recovered cluster counts much closer to the ground truth than Stochastic Variational Inference (SVI), which often over-clustered or failed to converge.
Conclusion
R-CRP provides a scalable, online alternative for nonparametric Bayesian clustering. By relaxing the requirement for exchangeability and using recursive approximations, it achieves $O(t \log t)$ time complexity and $O(\log t)$ space complexity. While the filtering nature of the algorithm means it cannot retroactively correct past assignments, it offers a powerful tool for processing high-volume data streams where traditional BNP methods fail to scale.
Summary updated