One-Pass Density Validation for Subspace Clustering on Disk-Resident Data

Many large datasets cluster into groups that each lie near a low-dimensional flat surface (a linear subspace), and recovering those groups is called subspace clustering. The best methods for this cost quadratic or cubic time in the number of points, so a practical approach is to cluster only a small, carefully chosen sample (a "sketch") and then assign every other point to the nearest discovered subspace. The Sketch-and-Validate family of methods (SkeVa) chooses this sketch with smoothed density estimates. It draws many candidate sketches, rejects any that look like a single blob, and keeps the candidate whose density best matches a separate random validation sample. This works in memory. It breaks down when the data sit on disk, because every candidate and every validation sample is a set of uniformly random rows, and random disk seeks are orders of magnitude slower than sequential reads.

This proposal starts from a simple observation. The quantity SkeVa uses to compare densities, the Cauchy-Schwarz divergence between two Gaussian kernel density estimates, depends on each dataset only through an average of feature vectors. If those features are approximated with random Fourier features, the average for the entire disk-resident dataset can be computed in one sequential pass. That average does not depend on the order in which rows are stored, and averages from different disk blocks can be merged by adding them. The validation step therefore no longer needs a random validation sample. Every candidate sketch can be scored against the whole dataset, at the I/O cost of a single sequential scan. Storage order and block-to-block correlation, which defeat naive streaming, do not affect this score at all.

Core Claim

Write a Gaussian kernel density estimate with bandwidth $\sigma$ over a point set $S$ as $\hat p_S$. The overlap integral $\int \hat p_S \hat p_X$ equals the mean of a Gaussian kernel $k$ of width $\sqrt{2}\sigma$ over all pairs $(s, x)$. Let $z(\cdot) \in \mathbb{R}^M$ be a random Fourier feature map with $\mathbb{E}[z(a)^\top z(b)] = k(a,b)$, and let $\mu_S = \frac{1}{|S|}\sum_{s \in S} z(s)$ be the mean feature vector of $S$. Then

$$ D_{CS}(\hat p_S, \hat p_X) \approx -\log \frac{(\mu_S^\top \mu_X)^2}{(\mu_S^\top \mu_S)(\mu_X^\top \mu_X)}, $$

where $X$ is the full dataset. The approximation error shrinks roughly as $1/\sqrt{M}$, because each inner product is a Monte Carlo average over $M$ random frequencies. The vector $\mu_X$ is a sum over rows, so it can be computed block by block in one sequential read, merged across blocks or machines by addition, and maintained at several bandwidths at once for a cost of $M$ floats per bandwidth.

The claim is that replacing SkeVa's random validation sample with $\mu_X$ yields three things. Sketch selection becomes order-invariant, which makes it correct on unshuffled disk layouts. Validation becomes lower-variance, because comparing against the full dataset removes the error from a small validation sample. And the method becomes cheaper in I/O than any approach that draws repeated random validation samples. We expect the accuracy gain to be largest exactly where SkeVa-style methods are weakest: small or unequally populated subspaces in high dimension, where a validation sample of size $n'$ may contain only a handful of points from the minority subspace.

Relation to Prior Work

The method builds directly on the sketch-and-validate line. Sketch and Validate for Big Data Clustering introduced the draw–score–validate loop and its divergence-based variant DiSkeVa for K-means-type clustering. Large-scale subspace clustering using random sketching and validation and A randomized approach to large-scale subspace clustering carried it to subspace clustering, with a bound on the number of trial draws under a Gaussian mixture model. Efficient subspace clustering of large-scale data streams with misses applied it to streams with missing entries. All of these supply our candidate-generation and assignment steps. All of them also assume cheap uniform random access and compare against a small validation sample, which is precisely what we remove.

The randomized subspace-clustering paper explicitly leaves the streaming extension open. Streaming statistical models via Merge & Reduce shows how to maintain mergeable statistics over streams, but only for regression-type summaries. Our mean feature vector is a mergeable sufficient statistic for the density comparison, so it fills that open slot without needing a merge tree at all.

The disk-I/O papers motivate the problem and constrain the design. A Sequential Addressing Subsampling Method for Massive Data Analysis Under Memory Constraint quantifies the cost of seeking to random rows and fixes it with one external shuffle followed by contiguous reads. scDataset shows that reading data in its stored order produces near-chance accuracy when that order is correlated with labels, while sampling contiguous blocks and reshuffling them in a memory buffer restores accuracy. Both papers serve sample means, regressions, or supervised SGD; neither filters samples by density. Our method sidesteps their trade-off for the validation step specifically, because a sum does not care about order.

Sketched Subspace Clustering compresses the dictionary with a random projection $\mathbf{B} = \mathbf{XR}$. That product is also computable in one pass, but the projection is oblivious to the data and may wash out small subspaces. It is our main non-SkeVa competitor. Scalable Sparse Subspace Clustering by Orthogonal Matching Pursuit supplies a fast in-memory solver to run on the selected sketch. Its finding that denser sampling within each subspace improves recovery is the reason a sketch that matches the full density, rather than an arbitrary block, should cluster better.

Research Program

The system has three stages, and every stage reads the disk sequentially.

Pass one: block summaries. We read the dataset block by block, as in the block-minimization design of Large Linear Classification When Data Cannot Fit in Memory, and accumulate three things: per-block mean feature vectors at a small grid of bandwidths, the global mean and covariance, and nothing else. The global mean and covariance define the single-Gaussian reference that SkeVa uses for its multimodality test, so that test also becomes a comparison against full-data statistics. Summing the per-block vectors gives $\mu_X$.

Candidate generation and scoring. Candidate sketches are drawn as unions of a few contiguous blocks, plus a light point-level subsample within each block. This keeps each candidate to a handful of seeks. Each candidate must first show high divergence from the unimodal reference, so that it contains multi-cluster structure. Among candidates that pass, we keep the one with the lowest divergence to $\mu_X$, meaning it best matches the full dataset.

We also test a second option that SkeVa cannot express: building the sketch greedily, by repeatedly adding the point (from the loaded blocks) that most reduces the mismatch with $\mu_X$. Because the per-block vectors are stored, the choice of which blocks to load can itself be guided by how much each block would improve the match. Bandwidth is chosen as the grid value that maximizes the global multimodality divergence. This is a cheap, data-driven answer to the bandwidth sensitivity reported for SkeVa-SC.

Pass two: clustering and assignment. We run SSC-OMP or SSC on the winning sketch in RAM. A second sequential pass then assigns all remaining points by their residual after projection onto each discovered subspace.

Theory. We will re-derive the bound on the number of trial draws. SkeVa's bound mixes two sources of error, the candidate's sampling error and the validation sample's sampling error. Under our scheme the second term is replaced by the random-feature error, which is controlled by $M$. Draws are no longer independent and identically distributed, so the bound must also account for the correlation between contiguous blocks. The analysis will make explicit how much block-level correlation in storage order the candidate step can tolerate.

Baselines

Uniform random subsample. The naive reference point is a single uniform random subsample that fits in RAM, clustered with SSC-OMP and followed by residual assignment. This is the single-draw SSSC baseline that SkeVa-SC was shown to beat. It is drawn by random addressing so that its I/O cost is honest. Beating it means higher accuracy and normalized mutual information (NMI) with lower variance across seeds, at comparable wall-clock time.

SAS shuffle plus original SkeVa-SC. The strongest competitor runs the original SkeVa-SC on a file that has first been externally shuffled with Sequential Addressing Subsampling. Every candidate and validation sample then becomes a cheap contiguous read. This is the obvious engineering fix and it may well suffice. For the I/O side of this baseline, the SAS paper reports that its hard-drive sampling cost for 1,000,000 points falls from 45.85 s to 1.11 s, with an external shuffle under 200 s on about 1.4 GB. For SkeVa-SC accuracy on PokerHand, PenDigits, Extended Yale B, or the synthetic data, no reported numerical result was found on Lacuna; the papers state only qualitative wins over SSSC. We will therefore re-run SkeVa-SC ourselves.

The comparison will be fair on every axis. Both methods get the same sketch size $n$ and the same number of candidates. SkeVa-SC gets its best validation size $n'$, tuned on the same grid budget we use to tune $M$ and the bandwidth grid. Both use the same SSC-OMP solver and the same RAM cap. Total wall-clock time includes the shuffle for SAS and both passes for our method. Beating this baseline means matching or exceeding its accuracy at lower total I/O on unshuffled files, and exceeding its accuracy on minority subspaces even when it runs on the shuffled file.

Sketched Subspace Clustering. We run Sketch-SC with its random-projection dictionary computed out of core in one pass. The paper reports about 45 minutes for 1,000,000 PokerHand points. We will report clustering accuracy, minority-subspace recall, and time under the same RAM cap.

Block-sampling loader. We feed SkeVa-SC through scDataset-style block sampling, with block size $b$ and fetch factor $f$ tuned under the same budget. This tests whether buffer reshuffling alone fixes the order problem.

Key ablation. The ablation that isolates our key ingredient runs our full pipeline with exactly one change: the global vector $\mu_X$ is replaced by a mean vector computed from a random validation sample of size $n'$, on the same shuffled file. If the full-data comparison is not what drives the gains, this ablation will match the full method. A second ablation drops the greedy point selection and keeps plain block-union candidates.

Why not just…?

Why not just shuffle the file once with SAS and run SkeVa unchanged? This is the real threat. On a file that can be rewritten, it removes most of the seek cost, and our I/O advantage there shrinks to avoiding repeated validation draws. Our case rests on two other things. First, many disk-resident datasets cannot be cheaply rewritten, such as shared single-cell stores or append-only logs, and our method needs no rewrite. Second, a small validation sample is noisy precisely for small subspaces. The ablation on a shuffled file directly measures whether the full-data comparison improves accuracy at equal $n'$-free cost. If it does not, the honest conclusion is that SAS plus SkeVa is enough, and our contribution reduces to the order-invariance result.

Why not just take one uniform subsample and cluster it? The randomized subspace-clustering papers report that single-draw SSSC has high variance and misses unequally populated subspaces. BM-LIBLINEAR and Woody report the analogous accuracy loss from in-memory subsamples in classification. We include this baseline anyway, so the size of the gap is measured on our own data rather than assumed.

Why not just stream blocks in stored order with buffer reshuffling, as scDataset does? scDataset shows that buffer reshuffling repairs SGD training, but SkeVa's validation compares densities. A buffer drawn from a few blocks still under-represents subspaces whose points sit in distant blocks. Our sorted-by-subspace storage condition is designed to expose exactly this failure, and the block-loader baseline measures it.

Why not just use a random projection, as Sketch-SC does? The projection is also one pass. However, the SkeVa paper reports that data-oblivious projections often miss cluster structure. Our minority-subspace experiments test whether that holds in the subspace setting.

Proposed Experiments

The main testbed is synthetic data built to stress storage order and imbalance. We generate unions of $K=5$ subspaces in $D=100$ and $D=500$, following the SkeVa-SC synthetic protocol, scaled to $10^8$ points (tens of gigabytes). Subspace populations range from balanced to 100:1, and the data are written to disk in three layouts: shuffled, sorted by subspace, and in slowly drifting order. All runs use a 1 GB RAM cap, mirroring the BM-LIBLINEAR setting, on both an HDD and an NVMe SSD. We measure clustering accuracy, NMI, recall on the smallest subspace, variance over 20 seeds, total bytes read, number of seeks, and wall-clock time.

On real data, we use PenDigits, Extended Yale B, and MNIST for in-memory sanity checks, where all methods should agree. We use PokerHand at 1M points for comparison with Sketch-SC's reported runtime. There we expect weak NMI for every density method because the attributes are discrete, and we will report it as a known limitation rather than a target. As an exploratory real out-of-core case, we use Tahoe-100M (about 300 GB, stored in plate order), with cell line as the cluster label. The subspace assumption is unverified there, so results will be reported as cluster recovery, not as a subspace-model test.

Three outcomes would be decisive. First, on the sorted-by-subspace layout, our method should hold its accuracy while SkeVa fed through blocks or naive streaming collapses. A failure here falsifies the order-invariance claim. Second, the ablation on a shuffled file should show the full-data comparison beating an $n'$-sample comparison on minority-subspace recall at 100:1 imbalance. If it does not, the variance-reduction claim fails, and we will concede that SAS plus SkeVa is adequate. Third, the error should fall with $M$ roughly as $1/\sqrt{M}$, and accuracy should plateau at a modest $M$ (we expect a few thousand features). If the plateau requires $M$ comparable to $n'$, the memory argument weakens and we will report that.