# A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction

**Authors:** Keyang Yin, Jia Deng, Huixia Li, Chunhui Feng, Jie Peng

PMC · DOI: 10.3390/s26010195 · Sensors (Basel, Switzerland) · 2025-12-27

## TL;DR

A new dynamic ensemble model using self-attention improves soil organic matter prediction accuracy with visible-near infrared spectroscopy.

## Contribution

A self-attention mechanism-based dynamic weight allocation method is introduced for ensemble models in soil hyperspectral prediction.

## Key findings

- Dynamic weight assignment improves ensemble model performance and robustness.
- Self-attention mechanism (Sam) provides the best weight allocation for ensemble models.
- Optimal performance is achieved with 26 base learners in the ensemble.

## Abstract

What are the main findings?
Dynamic weight assignment is effective for weighted averaging ensemble models.Weighting methods based on training process information outperform traditional evaluation-index-based methods.The self-attention mechanism provides the most effective weight allocation.The best ensemble performance is achieved with 26 base learners.

Dynamic weight assignment is effective for weighted averaging ensemble models.

Weighting methods based on training process information outperform traditional evaluation-index-based methods.

The self-attention mechanism provides the most effective weight allocation.

The best ensemble performance is achieved with 26 base learners.

What is the implication of the main finding?
Dynamic weight allocation enhances the generalization performance and robustness of ensemble models and reduces sensitivity to outliers and noise.This study provides scientific theoretical support for high-accuracy SOM monitoring using Vis–NIR spectroscopy.

Dynamic weight allocation enhances the generalization performance and robustness of ensemble models and reduces sensitivity to outliers and noise.

This study provides scientific theoretical support for high-accuracy SOM monitoring using Vis–NIR spectroscopy.

Visible–near-infrared spectroscopy enables rapid, non-destructive soil organic matter (SOM) detection, yet its prediction accuracy relies heavily on the effectiveness of the chosen algorithmic models. Weighted Averaging Ensemble Models (WAEM) are robust but face a key challenge: their performance depends on optimal base learner weight allocation, which standard evaluation indices often fail to achieve, risking biased weights and local optima. This study significantly enhances WAEM by determining optimal weights using information extracted from the model training process via seven methods, including reinforcement learning and a self-attention mechanism (Sam). Experiments on 704 soil samples from China’s Tarim River Basin employed a dynamic data structure for real-time weight updating. Results show that six WAEM methods utilizing training process information outperformed conventional evaluation index approaches. Improvements reduced WAEM root mean square error (RMSE) by 0.028–1.279 g kg−1 and increased the correlation coefficient (R2) by up to 0.06. Sam achieved the highest performance, with R2 and RMSE reaching 0.927 and 2.325 g kg−1, respectively. Furthermore, model R2 began converging at 26 base learners, indicating diminishing returns from adding more. This research confirms that dynamic WAEM weight allocation via Sam significantly boosts SOM prediction accuracy, providing a scientific foundation for infrared-based soil monitoring.

## Full-text entities

- **Chemicals:** organic matter (-)

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12788271/full.md

## Figures

10 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12788271/full.md

## References

74 references — full list in the complete paper: https://tomesphere.com/paper/PMC12788271/full.md

---
Source: https://tomesphere.com/paper/PMC12788271