Skip to content
AI.info

Research

GAMMA_FLOW: Guided Analysis of Multi-label spectra by MAtrix Factorization for Lightweight Operational Workflows

Overview Research area: Applied machine learning for spectroscopic data analysis, combining supervised non-negative matrix factorization (NMF) with classical signal processing. The motivating domain i

GAMMA_FLOW: Guided Analysis of Multi-label spectra by MAtrix Factorization for Lightweight Operational Workflows
arXiv
2511.09326
Published
2025-11-12
Authors
Viola Rädle, Tilman Hartwig, Benjamin Oesen, Emily Alice Kröger, Julius Vogt, Eike Gericke, Martin Baron

AI summary

Overview

  • Research area: Applied machine learning for spectroscopic data analysis, combining supervised non-negative matrix factorization (NMF) with classical signal processing. The motivating domain is nuclear safety and gamma-ray spectroscopy, but the authors state the method applies to any one-dimensional spectral data.
  • Technical level: Intermediate. The underlying mathematics (non-negative least squares, matrix decomposition) is presented in accessible form, and the software is packaged as three explanatory Jupyter notebooks, but readers will benefit from some familiarity with linear algebra and spectroscopy concepts.
  • Scope sentence: The paper describes gamma_flow, an open-source Python package (version 0.9.0) that performs classification, denoising, decomposition, and outlier detection of single- and multi-label one-dimensional spectra using a supervised NMF approach with a predefined loadings matrix, achieving classification accuracies above 90%.

What This Paper Is About

Manual identification of isotopes in gamma spectra is strenuous, error-prone, and dependent on expert knowledge, yet nuclear security applications require real-time analysis at roughly one spectrum per second, which produces noisy, low-resolution data. Training data for some radioactive sources may be unavailable and must instead be simulated with Monte Carlo N-Particle (MCNP) code, so simulated and measured spectra differ. The goal of gamma_flow is to provide a fast, interpretable, openly available analysis tool that classifies single-label spectra, decomposes multi-label mixtures of isotopes, denoises spectra, and flags spectra of isotopes the model was never trained on.

Key Contributions

  1. A supervised variant of non-negative matrix factorization for spectra. Rather than learning the loadings matrix, gamma_flow predefines it as the mean spectra of the training isotopes, so the scores axes correspond directly to an isotope's share in a spectrum and the latent space is physically interpretable.
  2. Direct multi-label decomposition. Because the normalized scores vector reveals the relative contribution of each isotope, linear combinations of isotopes can be decomposed, which the authors note rules out classifier approaches such as k-nearest-neighbours that depend only on training-to-test similarity.
  3. An integrated, lightweight workflow with outlier detection. Three sequentially executed Jupyter notebooks (01_preprocessing.ipynb, 02_model.ipynb, 03_outlier.ipynb) cover preprocessing and data exploration, model training and testing, and outlier analysis. Outlier detection uses the cosine similarity between the original and denoised spectrum as the key feature, with a decision boundary derivable from a decision tree split, a fitted logistic regression, or a manually chosen threshold.
  4. An open, transparent alternative to proprietary spectral analysis software. The package is released under the BSD 3-Clause license, runs on Linux and Microsoft Windows, requires Python ≥ 3.12 plus matplotlib, numpy, pandas, scikit_learn, scipy, seaborn, and openpyxl, and needs no special hardware or extensive computational power.

Main Findings

  • Classification accuracy of 94.8% in the illustrative example. A model trained on simulated spectra of Americium-241 (241Am), Cobalt-60 (60Co), Caesium-137 (137Cs), and Europium-152 (152Eu), all free of background radiation, plus pure measured background spectra, was inferenced on a measured test dataset from a different detector containing either a single isotope combined with background or pure background only. No background subtraction was applied.
  • Misclassifications occurred only between an isotope and background. No confusion occurred between two different isotopes. The authors attribute these cases to isotope signals near the detection threshold where the model's prediction deviates from the manually assigned label.
  • Successful denoising demonstrated on a 137Cs plus background spectrum. The model predicted 16% share of 137Cs and 83% background. Reconstruction quality was quantified by a cosine similarity of 0.99 and an explained variance ratio of 98.14%.
  • Outlier detection threshold guidance. The most informative feature for separating known from unknown spectra was the cosine similarity between the original and denoised spectrum. In the example, a threshold between 0.5 and 0.9 was judged an adequate choice.
  • Noise robustness. The authors report that the model performance on the noisy gamma dataset demonstrates applicability to noisy spectra, and that adding Gaussian noise to the spectra has only a minor effect on classification and denoising results. Higher noise ratios result in slightly diminished cosine similarities, shifting the decision boundary towards smaller values.
  • Scalability observed in preliminary tests. A reduction from 256 channels to 18 components was tested successfully, but the authors state the upper limit remains dataset-specific.
  • Abstract-level claim. The abstract states that gamma_flow achieves classification accuracies above 90% and enables reliable automated spectral interpretation.

Methodology in Plain English

The core idea is to avoid training a large model. Instead, the researchers build a fixed library of reference spectra: for each isotope in the training set, the mean spectrum is computed detector-wise, and these mean spectra become the columns of a "loadings" matrix. The matrix of measured spectra is then approximated as the product of a scores matrix and the transpose of this loadings matrix.

To find the scores for a new spectrum, the software solves a non-negative least squares problem — essentially finding the combination of reference spectra that best reproduces the measured spectrum, with the constraint that no isotope contribution may be negative. This is done with scipy.optimize.nnls, based on the Lawson-Hanson active-set algorithm, which the paper notes is guaranteed to converge to the global minimum of the convex problem for each spectrum and enforces strict non-negativity of the coefficients.

Because the loadings are the isotope mean spectra, the normalized scores read out directly as the relative contribution of each isotope, giving an explainable quantitative decomposition. Denoising works by the reverse operation: multiplying the non-normalized scores back by the loadings matrix, which removes noise orthogonal to the latent space. For outlier detection, the software trains a model with one specific isotope deliberately removed, then infer projects spectra of that unknown isotope. A decision tree with permutation feature importance identifies the most informative feature (cosine similarity between original and denoised spectrum), and a decision boundary is derived either from the first tree split, from a logistic regression fit, or from a manual threshold chosen by inspecting accuracy, precision, and recall.

Preprocessing handles file format conversion from .xlsm/.spe to .npy, rebinning spectra with different energy calibrations to a standard calibration, aggregation of data by label class and detector, optional limiting of spectra per isotope for class balance, and saving to .npy. Data exploration produces mean spectra per label class, cosine similarity comparisons between label classes and detectors, and random example spectrum plots to assess whether the model can handle spectra from different detectors. Results are visualized as confusion matrices, misclassified spectra, denoised example spectra, misclassification statistics, score scatter matrices, and mean score bar plots.

Why This Matters

Impact on research. The paper positions gamma_flow as a complement to prior work such as Bilton et al. and Bandstra et al., extending supervised dimensionality reduction combined with classical signal processing into reproducible and interpretable spectral analysis pipelines. Unlike robust and sparse NMF variants, graph-regularized and orthogonal NMF, and subspace-based extensions, gamma_flow preserves all physically relevant peaks by using a cosine similarity check for outlier detection rather than sparsity or orthogonality constraints that can alter small but relevant isotope contributions or conflict with overlapping peaks. Unlike supervised NMF approaches that learn latent components and coefficients jointly via a classification loss, gamma_flow fixes the basis from labelled training data and estimates coefficients via non-negative least squares, reducing computational cost while keeping physical interpretability.

Real-world applications (the authors state the package suits any one-dimensional spectra and list these examples):

  • Infrared spectroscopy for assessing the polymer composition of microplastics in water.
  • Mass spectrometry for protein identification in snake venom.
  • Raman spectroscopy for analysis of complex pharmaceutical mixtures and detection of dilution products such as lactose.
  • UV-Vis spectroscopy for detection of pesticides in surface waters.
  • Stellar spectroscopy to infer the chemical composition of stars.

Additionally, the original motivation is nuclear security, where immediate reaction and decision making are required and where mobile, room-temperature detectors produce low-resolution spectra under high temporal resolution (usually around one spectrum per second).

Industry relevance. The authors argue that proprietary spectral analysis software is often limited in functionality and adaptability, keeps its underlying mechanisms hidden as a black-box system, and typically only permits spectral comparison for pure probes. gamma_flow is intended to close this gap for decomposing multi-label spectra. Because training and inference require no special hardware or extensive computational power, the authors state it allows real-time application on ordinary laboratory computers and easy implementation into measurement routines, with the derived outlier decision boundary implementable in a user's measurement pipeline.

Future Directions

  • Extending beyond a predefined basis. The authors state that applicability is limited by reliance on a predefined basis, making the approach suitable only when relevant isotopes are known and labelled spectra are available. If only mixtures are present, an initial NMF decomposition is required to obtain training spectra.
  • Addressing the absence of orthogonality constraints. The paper notes performance is strongly dataset-dependent because similar isotope spectra can be confused, which may limit scalability; users are advised to assess the correlation between latent components via their cosine similarity matrix in the data exploration step. The upper limit on the number of components remains dataset-specific, having been tested successfully only at 256 channels reduced to 18 components.
  • Testing on spectra with positive and negative signals. In theory the non-negativity constraint applies only to the scores matrix, which would allow analysis of spectra containing both positive and negative signals such as difference spectra, but the authors state the algorithm has not yet been tested for these use cases.
  • Broadening to non-gamma spectra and handling mislabelled or rebinned data. The fixed-basis approach assumes loadings match the resolution and peak shapes of the target data, and substantially broader or asymmetric peaks may reduce reconstruction accuracy and classification performance. There is no intrinsic robustness against mislabelled training spectra, requiring careful expert validation, and preprocessing choices — especially rebinning parameters — can cause data loss or resolution degradation if far outside the calibration range.

Target Audience

This paper benefits spectroscopists and applied machine learning practitioners who need fast, interpretable, real-time analysis of one-dimensional spectra without specialized hardware. It is particularly relevant to researchers and engineers in nuclear security and radiation protection, given the author affiliations with the German Environmental Agency's Application Lab for AI and Big Data and the Federal Office for Radiation Protection, as well as to scientists in materials science, chemistry, environmental monitoring, and stellar spectroscopy. Scientists seeking an open, transparent, BSD-licensed alternative to proprietary spectral analysis software are a primary audience, as are readers who value a notebook-based workflow that builds understanding of the underlying processes without requiring advanced mathematical or programming expertise.

Authors’ abstract

GAMMA_FLOW is an open-source Python package for real-time analysis of spectral data. It supports classification, denoising, decomposition, and outlier detection of both single- and multi-component spectra. Instead of relying on large, computationally intensive models, it employs a supervised approach to non-negative matrix factorization (NMF) for dimensionality reduction. This ensures a fast, efficient, and adaptable analysis while reducing computational costs. gamma_flow achieves classification accuracies above 90% and enables reliable automated spectral interpretation. Originally developed for gamma-ray spectra, it is applicable to any type of one-dimensional spectral data. As an open and flexible alternative to proprietary software, it supports various applications in research and industry.

Read the original paper