Spectral basis benchmark

The figure below uses the bundled demo spectra as the true basis, then generates a synthetic mixture matrix from them. That gives us a controlled comparison in which the target basis is known and both SpectralUnmix and NMF::nmf() can be compared on the same problem.

coelho_summary_path <- "data/coelho-basis-benchmark-summary.csv"
coelho_bench <- read.csv(coelho_summary_path, stringsAsFactors = FALSE)
  knitr::include_graphics("images/coelho-basis-benchmark.png")

  coelho_bench$reconstruction_mse <- signif(coelho_bench$reconstruction_mse, 4)
  coelho_bench$basis_mse <- signif(coelho_bench$basis_mse, 4)
  knitr::kable(coelho_bench, caption = "Coelho basis benchmark summary.")
Coelho basis benchmark summary.
method reconstruction_mse basis_mse iterations converged
SpectralUnmix 1e-07 0.001256 2000 FALSE
NMF 1e-07 0.001300 NA NA

What we are testing here

The test suite verifies three things:

  • spectral_unmix() recovers a noise-free low-rank factorization with small reconstruction and component-spectrum error.
  • spectral_unmix() is competitive with NMF::nmf(method = "lee") on the same toy problem after matching fitted components to the reference ordering.
  • early stopping and convergence bookkeeping are exposed through loss, niter_run, and converged.

Interpreting the diagnostics

  • fit$loss is the optimization history.
  • fit$niter_run is the number of iterations actually executed.
  • fit$converged indicates whether early stopping triggered before the maximum iteration budget.