A hyperspectral camera records hundreds of color channels per pixel. Because pixels are coarse, most of them mix several surface materials, such as grass, roof, and road. Endmember extraction is the task of recovering the pure spectrum of each material (the "endmembers") and the fraction of each material in every pixel (the "abundances"), with no labels. Geometrically, linearly mixed pixels lie inside a simplex, a high-dimensional triangle whose corners are the pure materials. Almost every extraction method needs to be told how many corners to look for, and the standard ways of guessing that number fail badly. On a synthetic scene with 6 true minerals, the subspace estimator HySime reports 16 and Random Matrix Theory reports 25. On the Washington DC Mall image, HySime reports 38 (Estimating the Number of Endmembers…). The cause is that these tools count directions of variance. Illumination changes and natural variation within one material add variance just as a new material does.
We propose to choose the number of materials, and whether extra variance is a new material or variation of an existing one, by a single score. A model is fitted on some spatial blocks of the image. It then has to assign probability to the pixels in the other blocks, with each new pixel's material fractions averaged over all possible mixtures rather than fitted. Averaging over mixtures, instead of optimizing them, puts the Bayesian Occam's razor where the extra complexity actually lives. A simplex with one unnecessary corner spreads its probability over a larger volume, so it predicts real pixels less sharply. Conditioning on training blocks first avoids the known failure of the plain marginal likelihood under vague priors.
Core Claim
The quantity to compare across model structures $M$ (number of endmembers $K$, with or without per-pixel spectral variability) is the held-out conditional evidence
$$S(M)=\sum_{b}\sum_{i\in B_b}\log \int\!\!\int p(y_i\mid E,a_i,M)\,p(a_i\mid M)\,p(E\mid Y_{-b},M)\,da_i\,dE .$$
Here $B_b$ is a spatial block of pixels, $Y_{-b}$ is all pixels outside that block, and $y_i$ is the spectrum of pixel $i$. $E$ is the endmember matrix, or the variability-augmented endmembers. The abundance vector $a_i$ ranges over the $(K-1)$-dimensional probability simplex, with a Dirichlet prior $p(a_i\mid M)$.
Three properties make this score worth building.
First, the inner integral over $a_i$ is low-dimensional, since $K$ is rarely above about 10. It can therefore be estimated accurately by importance sampling. This contrasts with full marginal likelihoods over all endmembers and all abundances.
Second, the integrand is unchanged when the endmembers are relabeled. The multimodality caused by label switching, which breaks Laplace and BIC approximations, does not bias the score.
Third, if the abundance integral is replaced by a fitted abundance, the score becomes ordinary held-out reconstruction error. That error typically improves as corners are added, because any held-out pixel can be fitted at least as well by a larger simplex. The marginalization over $a_i$ is therefore the ingredient that supplies the penalty, and it can be removed cleanly in an ablation.
Relation to Prior Work
Two lines of work supply the method. The Bayesian Occam factor, the posterior-to-prior volume ratio that penalizes flexible models, comes from MacKay. Bayesian Model Selection, the Marginal Likelihood, and Generalization shows that the plain marginal likelihood underfits when priors are vague. It also shows that a conditional marginal likelihood, which scores later data given earlier data, behaves better, but it leaves open how much to condition on. Endmember spectra are bounded only by $[0,1]$ in each of roughly 200 bands. This is exactly the vague-prior regime where the plain evidence should reject faint but real materials. Our spatial-block conditioning answers the "how much" question in a way suited to images: every pixel is scored exactly once, and spatial leakage is controlled by the block size.
Three papers set the competitive bar. Joint Bayesian endmember extraction and linear unmixing builds a hierarchical Bayesian unmixing model with physical constraints and a Gibbs sampler. It takes $K$ as given and is slow: 3250 s versus 1 s for the geometric method VCA on a 32×32 cube. We reuse its constrained prior structure but never compare evidence for a fixed $K$. The collaborative-sparsity paper prunes an overcomplete candidate set along an ADMM path, using a model with a per-pixel scalar illumination factor, and picks $K$ by BIC. It recovers 6 on its synthetic cube and selects 7 on DC Mall. Its BIC is computed on point estimates, and its variability model is a single scalar. Low-rank and sparse NMF prunes columns with a group-sparsity penalty, going from 10 to 4 on synthetic data and from 8 to 3 on Mars OMEGA. Its outcome depends on a hand-tuned penalty weight. Neither of the last two can say whether a residual direction is a new material or variability, except through a fixed model choice.
HELEN provides scalable variational inference with endmember variability, reported as up to 400× faster than MCMC. It fixes both $K$ and the spatial patch size by hand, and we use it as our posterior engine.
Bayesian sparse reconstruction samples the model order jointly with parameters by nested sampling, with 10–40× savings over separate evidence runs. It does not handle simplex constraints. We use it only as a full-evidence reference on small cubes, not as the main tool, for two reasons: it computes the plain marginal likelihood that Lotfi et al. warn about, and it does not scale to full scenes.
Research Program
For each candidate structure $M$, we fit an approximate endmember posterior $p(E\mid Y_{-b},M)$ on the training blocks. Endmembers are initialized from a minimum-volume simplex fit, so that we do not depend on pure pixels. The structures cover $K\in\{1,\dots,K_{\max}\}$ under a static model, under HELEN's patch-wise variability, and under the scalar-scaling model. Patch size is treated as a further discrete structure, which directly addresses HELEN's manual choice. The Dirichlet concentration and the noise level are set by empirical Bayes on the training blocks, separately for each $M$, so that the prior is informed by the scene rather than left vague.
To score a held-out pixel, we draw $S$ posterior endmember samples. For each sample we importance-sample the abundance integral, using a proposal centered on the constrained least-squares abundance. We verify this estimator against brute-force quadrature for $K\le4$.
The analysis component characterizes when the score separates "new material" from "variability". The working hypothesis is that a variability model wins when residual directions are spatially local and low in amplitude relative to the noise. A new corner wins when some pixels sit consistently outside the current simplex. We will test this against controlled synthetic sweeps.
Baselines
The naive reference is HySime, a subspace estimator that counts signal directions after estimating noise, followed by VCA at that $K$. Its reported counts of 16 and 25 (for RMT) against a truth of 6 (collaborative-sparsity paper) show how bad doing nothing principled is.
The strongest existing competitor is the ADMM path with BIC from the same paper. It is the only method in the file that combines a variability model with an explicit evidence-style criterion, and it reports the exact true count, 6, on its synthetic cube. We re-implement it on identical data, using the same initial overcomplete candidate set, the same $K_{\max}$, and the same wall-clock budget as our method. Beating it means matching its 6 on that cube while being strictly more accurate, in exact-$K$ rate over seeds, on the regimes it was not designed for: band-dependent variability, scenes without pure pixels, and SNR of 15 dB and 5 dB.
Group-sparse NMF (Low-rank and sparse NMF) is run with its penalty weight chosen two ways: by its authors' heuristic, and by an oracle grid search on the true $K$. This gives an upper bound on what tuning can buy.
Two further baselines isolate ingredients of our method. The variational evidence lower bound (ELBO) of HELEN-style inference, compared across $K$, shows whether the gap between the bound and the true evidence varies with $K$ enough to mislead model choice. The key ablation replaces the abundance integral with the fitted abundance, keeping everything else fixed. This tests whether marginalizing the abundances is what produces the correct answer.
Why not just…?
Why not just use HySime or virtual dimensionality? They count variance directions and cannot tell illumination from chemistry. The reported overestimates (16 versus 6, and 38 on DC Mall) settle this.
Why not just trace the ADMM path and apply BIC? This is the real threat, given that it reports 6 of 6. BIC's penalty counts parameters, but here the abundances and variability terms grow with the number of pixels, which is exactly the setting where the asymptotic justification of BIC is weakest. The method also cannot recover a material missed by its initial candidate extraction. We expect it to stay correct when variability is a scalar scaling, which matches its model, and to drift under band-dependent variability or missing pure pixels. The synthetic sweeps will show whether it in fact does. If it does not drift, our contribution narrows to the variability-versus-material question and to uncertainty over $K$.
Why not just cross-validate held-out reconstruction error? Fitting abundances to held-out pixels rewards extra corners, which is the problem described in the Core Claim. The fitted-abundance ablation measures this directly.
Why not compute the full marginal likelihood with nested sampling? On small cubes we will do so, as a reference. Lotfi et al. predict that with vague spectral priors it will undercount faint materials. If instead it agrees with our score, that is useful evidence, but its cost still rules it out for full scenes.
Proposed Experiments
Synthetic data come from three sources. The first is the 6-mineral, 300-band, 40×40 cube at 25 dB from the collaborative-sparsity paper, regenerated over many seeds. The second is the 3- and 5-endmember USGS cubes at 5, 15, and 25 dB from the joint Bayesian paper. The third is the HySUPP DC1–DC3 pure and no-pure-pixel scenes (HySUPP). To these we add a controlled sweep in which variability amplitude and its band-dependence are dialed up while the true $K$ is held fixed. We report exact-$K$ rate, mean $|\hat K-K|$, the spectral angle between recovered and true endmembers, abundance root-mean-square error, and calibration of the posterior over $K$.
On real data, Mars OMEGA has three physically identified components ($H_2O$ ice, $CO_2$ ice, dust), and AVIRIS Moffett has three (vegetation, water, soil). For DC Mall and Cuprite there is no agreed true count. There we report the selected $K$ and check the recovered spectra against USGS library matches for Cuprite, and inspect DC Mall's spectra for physical interpretability. We found no reported numerical error on Lacuna for Moffett or Cuprite.
Three checks are decisive. The method must hold the correct $K$ across the variability sweep where BIC inflates it. The fitted-abundance ablation must overshoot. And on small cubes, the plain nested-sampling evidence must undercount where the held-out score does not.
References
- Estimating the Number of Endmembers to Use in Spectral Unmixing of Hyperspectral Data with Collaborative Sparsity
- Bayesian Model Comparison and Backprop Nets
- Bayesian Model Selection, the Marginal Likelihood, and Generalization
- Joint Bayesian endmember extraction and linear unmixing for hyperspectral imagery
- Low-rank and sparse NMF for joint endmembers' number estimation and blind unmixing of hyperspectral images
- Hyperspectral Unmixing Under Endmember Variability: A Variational Inference Framework
- Bayesian sparse reconstruction: a brute-force approach to astronomical imaging and machine learning
- Image Processing and Machine Learning for Hyperspectral Unmixing: An Overview and the HySUPP Python Package