Spectral Model eXplainer (SMX)
- Spectral Model eXplainer (SMX) is a model-agnostic framework that explains spectral classifiers by summarizing expert-defined spectral zones via one-component PCA.
- It constructs quantile-based logical predicates and employs perturbation analysis with bagging to quantify the impact of spectral zones through a directed weighted graph.
- Its unique threshold spectrum reconstruction maps PCA thresholds back to natural measurement units, enabling direct visual comparison with measured spectra.
Searching arXiv for the SMX paper and closely related spectral explainability work to ground the article in current literature. Spectral Model eXplainer (SMX) is a post-hoc, global, model-agnostic explainability framework designed specifically for spectral machine learning. It explains trained spectral classifiers through expert-informed spectral zones rather than isolated spectral variables, summarizes each zone via PCA, defines quantile-based logical predicates, estimates predicate relevance with perturbation in stochastic subsamples, and aggregates bag-wise rankings in a directed weighted graph summarized by Local Reaching Centrality (Ribeiro et al., 4 May 2026). A distinctive component is threshold spectrum reconstruction, which back-projects predicate boundaries to the original spectral domain in natural measurement units, enabling direct visual comparison with measured spectra (Ribeiro et al., 4 May 2026).
1. Problem formulation and design motivation
SMX is motivated by the observation that spectral data are continuous, highly correlated, and physically organized along an energy/wavenumber axis (Ribeiro et al., 4 May 2026). In spectroscopy and chemometrics, practitioners usually care about chemically meaningful spectral regions or zones, not isolated single variables. Widely adopted tools such as SHAP, PFI, and VIP were not designed for the physical continuity and high collinearity of spectral data, and their variable-level outputs require post-hoc aggregation to recover zone-level information (Ribeiro et al., 4 May 2026).
The framework therefore shifts the unit of explanation from variables to zones. Instead of asking which individual variable mattered most, SMX asks which expert-defined spectral zones most influenced the model, under what threshold conditions, and how those conditions map back to a readable spectral boundary (Ribeiro et al., 4 May 2026). This makes the explanation objects chemically grounded: zones, predicates over zone summaries, and reconstructed threshold spectra in the instrument’s natural units.
The paper identifies several limitations of SHAP, PFI, and VIP in this setting. They work at the feature level rather than the zone level; they ignore spectral continuity and collinearity; they do not naturally encode chemically meaningful regions; they require post-hoc aggregation to recover zone-level insights; and some are model-specific or structurally limited, with VIP specific to PLS and gradient-based methods restricted to differentiable models (Ribeiro et al., 4 May 2026). By contrast, SMX is intended to work with PLS, SVM, and MLP because it is model-agnostic (Ribeiro et al., 4 May 2026).
A common misconception is that any method labeled “spectral” in XAI is closely aligned with SMX. Related work uses the term in different senses. “SpecXAI” analyzes a locally linear network operator via SVD and produces a spectral decomposition of the network’s action into ranked components (Druc et al., 2023), while “Uncovering the Structure of Explanation Quality with Spectral Analysis” studies singular values of redistribution matrices to characterize stability and target sensitivity of attribution methods (Maeß et al., 11 Apr 2025). SMX, in contrast, is a chemically grounded framework for spectral-based machine learning models that starts from expert-defined spectral zones and threshold spectra (Ribeiro et al., 4 May 2026).
2. Zone definition and PCA-based zone summarization
The first stage of SMX is the definition of spectral zones by expert knowledge. The spectrum is partitioned into meaningful zones , based on expected elemental lines, scattering regions, radionuclide peaks, or background bands (Ribeiro et al., 4 May 2026). These zones are specified a priori by the practitioner rather than learned from the model. Formally,
Each zone corresponds to a submatrix , where (Ribeiro et al., 4 May 2026).
Once zones are defined, SMX compresses each zone into a single scalar per sample using one-component PCA. For each zone , the centered zone matrix is summarized by the first principal loading vector
and the score of sample in zone is
These scores form a matrix (Ribeiro et al., 4 May 2026).
The fraction of variance explained by the first principal component is
0
This explained-variance ratio is later used to temper edge weights in the graph, so that zones whose first PC explains less of the zone structure are penalized (Ribeiro et al., 4 May 2026).
The paper gives two reasons for using PCA. First, it provides an optimal linear summary of the dominant variation in the zone. Second, it is invertible, which makes threshold back-projection to the original spectral domain possible (Ribeiro et al., 4 May 2026). This design ties dimensionality reduction directly to the later reconstruction step rather than treating the zone summary as a purely abstract latent coordinate.
3. Predicate construction, bagging, and perturbation-based relevance estimation
After zone scores are computed, SMX creates logical predicates by thresholding those scores at user-defined quantile levels. If the chosen quantiles are 1, the empirical threshold for zone 2 and quantile 3 is
4
Each threshold yields two complementary predicates:
5
The total number of candidate predicates is at most
6
with duplicates caused by tied thresholds removed. A binary indicator matrix 7 records which samples satisfy each predicate (Ribeiro et al., 4 May 2026).
These predicates are not merely importance labels for zones. Each predicate defines a subgroup of samples above or below a threshold in a zone summary space, and SMX later asks how much the model changes when the corresponding zone is perturbed for the samples satisfying that predicate (Ribeiro et al., 4 May 2026).
To improve robustness, SMX uses stochastic bagging. For each bag 8, it samples a subset 9 of size 0 without replacement, typically 1. For each predicate 2, the samples in the bag satisfying it are
3
If 4, the predicate is discarded for that bag; the paper uses 5 as 20% of the training set size. Bagging is repeated over several random seeds 6, and final scores are averaged across seeds to reduce stochastic variability (Ribeiro et al., 4 May 2026).
For a predicate 7 associated with zone 8, SMX perturbs the spectrum by replacing the zone variables with a reference value, defaulting to the training-set median:
9
This preserves all non-target zones while neutralizing the target zone (Ribeiro et al., 4 May 2026).
Predicate impact is quantified from model-output change. For regression-like outputs such as PLS predictions,
0
For classifiers such as SVM and MLP,
1
The score is then normalized by the zone length 2,
3
so wider zones are not automatically favored because they contain more variables (Ribeiro et al., 4 May 2026).
This perturbation logic is explicitly behavioral rather than coefficient-based. If a zone matters to the model, replacing its spectral values with an uninformative baseline should change the model’s output (Ribeiro et al., 4 May 2026).
4. Graph construction and Local Reaching Centrality
Within each bag, predicates are sorted in descending order of perturbation impact. The ordered list is converted into a directed path,
4
where 5 is the majority predicted class associated with the last predicate in the bag (Ribeiro et al., 4 May 2026). The edge weight is defined as
6
If multiple bags produce the same edge, the weights are summed. If bidirectional edges arise, SMX keeps only the stronger direction (Ribeiro et al., 4 May 2026).
The resulting object is a global directed weighted graph 7 over predicates plus class nodes. The paper stresses that this is not a causal graph; rather, it summarizes recurring local rankings across many bags (Ribeiro et al., 4 May 2026). The graph therefore records repeated evidence that certain predicates tend to appear high in importance orderings.
Global importance is then computed by Local Reaching Centrality (LRC),
8
where 9 is the shortest directed path from 0 to 1, 2 is its length, and 3 are the edge weights along that path (Ribeiro et al., 4 May 2026).
Intuitively, LRC is high for predicates that appear repeatedly in strong positions across many bags, can reach many other nodes through directed paths, and are supported by strong edge weights (Ribeiro et al., 4 May 2026). In SMX, LRC serves as the final global ranking score for predicates. A plausible implication is that the framework converts unstable local perturbation orderings into a more persistent graph summary before producing a final ranking.
5. Threshold spectrum reconstruction and chemically grounded interpretation
Threshold spectrum reconstruction is one of the most distinctive parts of SMX. Because each predicate is based on a PCA score threshold, that threshold can be mapped back to the original spectral domain:
4
The reconstructed threshold spectrum is the spectral profile that lies exactly on the predicate boundary in the original feature space (Ribeiro et al., 4 May 2026).
This matters because the threshold in PCA space is abstract and dimensionless, whereas the back-projected spectrum is expressed in the instrument’s natural measurement units, such as keV or wavenumber (Ribeiro et al., 4 May 2026). The reconstructed boundary can therefore be directly overlaid on measured spectra. The paper presents this as a substantial gain in interpretability, since a domain expert can inspect whether a sample lies above or below the boundary in the same coordinate system used in laboratory practice (Ribeiro et al., 4 May 2026).
In the soil fertility case study, predicates such as 5, 6, and 7 were reconstructed into spectral boundary curves that could be plotted over actual XRF spectra (Ribeiro et al., 4 May 2026). The main discriminative zones in that dataset were Ca Kα, Mn, Si, and Fe Kα, which the paper relates to the scientific context that soil fertility in the dataset is tied to base saturation percentage (BSP%), which depends on exchangeable Ca, Mg, K, and acidity (Ribeiro et al., 4 May 2026).
The paper further argues that these reconstructed thresholds make SMX actionable for screening, confirmatory analysis, calibration monitoring, or hypothesis generation (Ribeiro et al., 4 May 2026). This suggests that the explanatory output is not limited to feature ranking; it also functions as a readable boundary description in chemically meaningful coordinates.
6. Empirical evaluation, comparative results, and limitations
The study evaluates SMX on one synthetic benchmark dataset with known ground truth and eight real spectral datasets, all binary classification tasks: Bank notes (XRF), Forage (XRF), Milk (XRF), Sediments (XRF), Soil fertility (XRF), Soil fertility (GRS), Soil types (GRS), and Tomato (XRF) (Ribeiro et al., 4 May 2026). The synthetic dataset consisted of Gaussian peaks plus additive noise, with known discriminative zones in which Feature 1 had the strongest class separation, Feature 2 was weaker but relevant, and Feature 3 was non-discriminative or weakly discriminative depending on class setup (Ribeiro et al., 4 May 2026).
Data were split into 70% training/calibration and 30% test/validation using the Kennard–Stone algorithm. Preprocessing was mean centering for synthetic data, Poisson scaling plus mean centering for XRF, and Savitzky–Golay smoothing plus mean centering for GRS (Ribeiro et al., 4 May 2026). Three classifiers were trained for each dataset: PLS, SVM with RBF kernel, and MLP, with PLS latent variables selected by 10-fold cross-validation (Ribeiro et al., 4 May 2026). The default SMX hyperparameters were quantiles 8, bags 9, bag size 0, and 4 seeds (Ribeiro et al., 4 May 2026).
The comparison against SHAP, PFI, and VIP used four explainability desiderata: faithfulness, domain alignment, stability, and simplicity (Ribeiro et al., 4 May 2026). Faithfulness used progressive top-1 masking of ranked zones and measured output change using MAE or probability shift, with larger AUC indicating greater faithfulness. Domain alignment compared top-ranked zones to expert-defined plausible zones using cumulative agreement rate. Stability reran stochastic explainers with 10 seeds and compared ranked outputs using Rank-Biased Overlap, where lower instability 2 is better. Simplicity assessed cumulative concentration of importance in the top features or predicates, so that fewer features needed to accumulate importance indicated simpler explanations (Ribeiro et al., 4 May 2026). Pairwise statistical comparisons across datasets used Wilcoxon signed-rank tests (Ribeiro et al., 4 May 2026).
The reported findings are differentiated rather than uniformly favorable. Across eight datasets, SMX was generally faithfulness-equivalent to SHAP, PFI, and VIP in most comparisons. The only statistically significant difference reported for faithfulness was that, for MLP, SHAP outperformed SMX with 3 (Ribeiro et al., 4 May 2026). For domain alignment, SMX was often competitive or better than baselines in aligning with expert-plausible zones, especially for SVM and MLP, although the paper notes that this advantage is partly conditioned by the expert-defined zoning built into the method (Ribeiro et al., 4 May 2026). For stability, SMX was generally more stable than PFI, with a significant difference reported for SVM, where SMX was more stable than PFI with 4 (Ribeiro et al., 4 May 2026). For simplicity, SMX and SHAP were the simplest methods, both concentrating importance into fewer ranked entities than PFI and VIP; SMX was significantly simpler than PFI in all models and significantly simpler than VIP for PLS (Ribeiro et al., 4 May 2026).
The paper also notes that predictive performance itself varied across datasets. Most models achieved high test performance on easier datasets, often near 1.0 accuracy, whereas more difficult datasets included Milk, Sediments, Soil (GRS), and Tomato. Some model–dataset pairs performed poorly or degenerated, especially some MLP and GRS settings, and the paper explicitly cautions that explanations from weak models can be misleading and should not be over-interpreted (Ribeiro et al., 4 May 2026).
An ablation study on the synthetic benchmark examined the number of bags 5, bag size 6, number of repetitions 7, and quantile levels 8. The reported conclusions were that moderate numbers of bags and repetitions gave a good balance of stability and cost, smaller bags increased variability in perturbation effects, quantile choice mostly changed granularity rather than the identity of dominant zones, and the recommended settings were about 5–10 bags, 4–6 repetitions, bag sizes around 70–90% of the training set, and quantiles 9 (Ribeiro et al., 4 May 2026).
The limitations are explicit. The current version is binary classification only; extensions to multiclass and regression are described as conceptually straightforward but not yet implemented. Zone boundaries are expert-defined, which improves interpretability but reduces portability where prior spectroscopic knowledge is weak. Predicate thresholds are quantile-based, and more optimal threshold search strategies might improve performance. Computational cost can be substantial because perturbation scoring scales with the number of bags, predicates, repetitions, and model inference cost. External validation is limited to XRF, GRS, and synthetic data, with broader validation on vis-NIR, MIR, Raman, and LIBS still needed (Ribeiro et al., 4 May 2026).
Within the broader literature on spectral explainability, SMX occupies a specific niche. Unlike local spectral decompositions of network operators (Druc et al., 2023) or spectral diagnostics of attribution quality via singular values and metrics such as SSM (Maeß et al., 11 Apr 2025), SMX is a domain-grounded framework for spectral classifiers in chemometrics and spectroscopy that uses expert-defined zones, quantile predicates, perturbation, graph aggregation, and threshold reconstruction in natural measurement units (Ribeiro et al., 4 May 2026). A plausible implication is that its principal contribution lies less in generic attribution geometry than in aligning explanation outputs with the interpretive practices of analytical chemistry.