A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction
Highlights
- 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 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.
Abstract
1. Introduction
2. Materials and Methods
2.1. Study Area and Soil Sample Collection
2.2. Laboratory Analysis and Spectra Measurement of Soil Samples
2.3. Data Preprocessing and Division
2.4. Feature Selection
2.5. Proposed Methodology
2.5.1. Base Learners and Grid Search Optimization
2.5.2. Weighted Averaging
2.5.3. Q-Learning
2.5.4. Adaptive Filter
2.5.5. Adaptive Learning Methods
2.5.6. Self-Attention Mechanism
2.5.7. Genetic Algorithm
2.5.8. Meta-Learning
2.5.9. Adaptive Moment Estimation
2.5.10. R2 Normalization
2.6. Evaluation State and Dynamic Automatic Weighting Design
3. Results
3.1. Eight Methods to Calculate the Weights
3.2. Performance of Ensemble Models with Different Weights in Validation Sets
3.3. Impact of Base Learners Count on Ensemble Model Accuracy
3.4. Computation Power Change in Ensemble Mode Under Different Weight Allocation Methods
3.5. Research on Ensemble Model Loss Under Eight Weight Distribution Modes
4. Discussion
4.1. Dynamic Weight Allocation
4.2. The Influence of Different Weight Allocation Methods on EM
4.3. Effect of Number of Base Learners on WA EM
4.4. The Computing Power Consumption Under This Plan
4.5. Limitation and Future Work
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- FAO. A Primer on Soil Analysis Using Visible and Near-Infrared (Vis-NIR) and Mid-Infrared (MIR) Spectroscopy; FAO: Rome, Italy, 2022. [Google Scholar] [CrossRef]
- Lal, R. Soil carbon sequestration impacts on global climate change and food security. Science 2004, 304, 1623–1627. [Google Scholar] [CrossRef] [PubMed]
- Six, J.; Bossuyt, H.; Degryze, S.; Denef, K. A history of research on the link between (micro) aggregates, soil biota, and soil organic matter dynamics. Soil Tillage Res. 2004, 79, 7–31. [Google Scholar] [CrossRef]
- Fang, C.; Smith, P.; Smith, J.U.; Moncrieff, J.B. Incorporating microorganisms as decomposers into models to simulate soil organic matter decomposition. Geoderma 2005, 129, 139–146. [Google Scholar] [CrossRef]
- Hong, Y.; Sanderman, J.; Hengl, T.; Chen, S.; Wang, N.; Xue, J.; Zhuo, Z.; Peng, J.; Li, S.; Chen, Y.; et al. Potential of globally distributed topsoil mid-infrared spectral library for organic carbon estimation. CATENA 2024, 235, 107628. [Google Scholar] [CrossRef]
- Adhikari, K.; Hartemink, A.E. Linking soils to ecosystem services—A global review. Geoderma 2016, 262, 101–111. [Google Scholar] [CrossRef]
- Biney, J.K.M.; Blöcher, J.R.; Borůvka, L.; Vašát, R. Does the limited use of orthogonal signal correction pre-treatment approach to improve the prediction accuracy of soil organic carbon need attention? Geoderma 2021, 388, 114945. [Google Scholar] [CrossRef]
- Munnaf, M.A.; Guerrero, A.; Nawar, S.; Haesaert, G.; Van Meirvenne, M.; Mouazen, A.M. A combined data mining approach for on-line prediction of key soil quality indicators by Vis-NIR spectroscopy. Soil Tillage Res. 2021, 205, 104808. [Google Scholar] [CrossRef]
- Rossel, R.A.V.; Behrens, T.; Ben-Dor, E.; Chabrillat, S.; Demattê, J.A.M.; Ge, Y.; Gomez, C.; Guerrero, C.; Peng, Y.; Ramirez-Lopez, L.; et al. Diffuse reflectance spectroscopy for estimating soil properties: A technology for the 21st century. Eur. J. Soil Sci. 2022, 73, e13271. [Google Scholar] [CrossRef]
- Hong, Y.; Chen, S.; Hu, B.; Wang, N.; Xue, J.; Zhuo, Z.; Yang, Y.; Chen, Y.; Peng, J.; Liu, Y.; et al. Spectral fusion modeling for soil organic carbon by a parallel input-convolutional neural network. Geoderma 2023, 437, 116584. [Google Scholar] [CrossRef]
- Yang, M.; Chen, S.; Xu, D.; Zhao, X.; Shi, Z.; Qian, H.; Zhang, Z. Removing the moisture effect on predicting soil organic matter using vis-NIR spectroscopy with external parameter orthogonalization. Geoderma Reg. 2024, 37, e00797. [Google Scholar] [CrossRef]
- Shi, X.; Song, J.; Wang, H.; Lv, X.; Zhu, Y.; Zhang, W.; Bu, W.; Zeng, L. Improving soil organic matter estimation accuracy by combining optimal spectral preprocessing and feature selection methods based on pXRF and vis-NIR data fusion. Geoderma 2023, 430, 116301. [Google Scholar] [CrossRef]
- Mukhamediev, R.I.; Popova, Y.; Kuchin, Y.; Zaitseva, E.; Kalimoldayev, A.; Symagulov, A.; Levashenko, V.; Abdoldina, F.; Gopejenko, V.; Yakunin, K.; et al. Review of artificial intelligence and machine learning technologies: Classification, restrictions, opportunities and challenges. Mathematics 2022, 10, 2552. [Google Scholar] [CrossRef]
- Yang, J.; Wang, X.; Wang, R.; Wang, H. Combination of Convolutional Neural Networks and Recurrent Neural Networks for predicting soil properties using Vis- NIR spectroscopy. Geoderma 2020, 380, 114616. [Google Scholar] [CrossRef]
- Silva, S.H.G.; Ribeiro, B.T.; Guerra, M.B.B.; de Carvalho, H.W.P.; Lopes, G.; Carvalho, G.S.; Guilherme, L.R.G.; Resende, M.; Mancini, M.; Curi, N.; et al. PXRF in tropical soils: Methodology, applications, achievements and challenges. Adv. Agron. 2021, 167, 1–62. [Google Scholar] [CrossRef]
- Liu, J.J.; Hong, Y.S.; Hu, B.F.; Chen, S.C.; Deng, J.; Yin, K.Y.; Lin, J.; Luo, D.F.; Peng, J.; Shi, Z. Hyperspectral inversion of soil organic matter based on improved ensemble learning method. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2025, 339, 126302. [Google Scholar] [CrossRef]
- Bai, Z.; Xie, M.; Hu, B.; Luo, D.; Wan, C.; Peng, J.; Shi, Z. Estimation of soil organic carbon using vis-nir spectral data and spectral feature bands selection in Southern nanjiang, China. Sensors 2022, 22, 6124. [Google Scholar] [CrossRef]
- Talukder, M.S.H.; Sarkar, A.K. Nutrients deficiency diagnosis of rice crop by weighted average ensemble learning. Smart Agric. Technol. 2023, 4, 100155. [Google Scholar] [CrossRef]
- Anand, V.; Gupta, S.; Gupta, D.; Gulzar, Y.; Qin Juneja, S.; Shaikh, A. Weighted average ensemble deep learning model for stratification of brain tumor in MRI images. Diagnostics 2023, 13, 1320. [Google Scholar] [CrossRef]
- Polikar, R. Ensemble based systems in decision making. Circuits Syst. Mag. 2006, 6, 21–45. [Google Scholar] [CrossRef]
- Zhou, Z.-H.; Wu, J.; Tang, W. Ensembling neural networks: Many could be better than all. Artif. Intell. 2002, 137, 239–263. [Google Scholar] [CrossRef]
- Mahendran, N.; Vincent, D.R.; Srinivasan, K.; Chang, C.Y.; Garg, A.; Gao, L.; Reina, D.G. Sensor-assisted weighted average ensemble model for detecting major depressive disorder. Sensors 2019, 19, 4822. [Google Scholar] [CrossRef] [PubMed]
- Neloy, M.A.I.; Nahar, N.; Hossain, M.S.; Andersson, K. A Weighted Average Ensemble Technique to Predict Heart Disease. In Proceedings of the Third International Conference on Trends in Computational and Cognitive Engineering; Lecture Notes in Networks and Systems; Kaiser, M.S., Ray, K., Bandyopadhyay, A., Jacob, K., Long, K.S., Eds.; Springer: Singapore, 2022; Volume 348. [Google Scholar] [CrossRef]
- Kunapuli, G. Ensemble Methods for Machine Learning. Simon and Schuster. 2023. Available online: https://ieeexplore.ieee.org/servlet/opac?bknumber=10280513 (accessed on 8 March 2025).
- Fan, L.; Su, H.; Zio, E.; Chi, L.; Zhang, L.; Zhou, J.; Liu, Z.; Zhang, J. A deep reinforcement learning-based method for predictive management of demand response in natural gas pipeline networks. J. Clean. Prod. 2022, 335, 130274. [Google Scholar] [CrossRef]
- Zhang, L.; Su, H.; Zio, E.; Zhang, Z.; Chi, L.; Fan, L.; Zhou, J.; Zhang, J. A data-driven approach to anomaly detection and vulnerability dynamic analysis for large-scale integrated energy systems. Energy Convers. Manag. 2021, 234, 113926. [Google Scholar] [CrossRef]
- Watkins, C.J.; Dayan, P. Q-learning. Mach. Learn. 1992, 8, 279–292. [Google Scholar] [CrossRef]
- Zeiler, M.D. Adadelta: An adaptive learning rate method. arXiv 2012, arXiv:1212.5701. [Google Scholar] [CrossRef]
- Shaw, P.; Uszkoreit, J.; Vaswani, A. Self-attention with relative position representations. arXiv 2018, arXiv:1803.02155. [Google Scholar] [CrossRef]
- Song, L.; Cao, Z.; Sun, H.; Yu, Z.; Jiang, L. Transfer learning for structure damage detection of bridges through dynamic distribution adaptation. Structures 2024, 67, 106972. [Google Scholar] [CrossRef]
- Armstrong, R.D.; Kung, M.T. A linked list data structure for a simple linear regression algorithm. Comput. Oper. Res. 1984, 11, 295–305. [Google Scholar] [CrossRef]
- Yang, X.; Preusser, F.; Radtke, U. Late Quaternary environmental changes in the Taklamakan Desert, western China, inferred from OSL-dated lacustrine and aeolian deposits. Quat. Sci. Rev. 2006, 25, 923–932. [Google Scholar] [CrossRef]
- Mebius, L.J. A rapid and accurate procedure for estimation of organic carbon in soils. Anal. Chim. Acta 1960, 22, 120–124. [Google Scholar] [CrossRef]
- Dotto, A.C.; Dalmolin, R.S.D.; ten Caten, A.; Grunwald, S. A systematic study on the application of scatter-corrective and spectral-derivative preprocessing for multivariate prediction of soil organic carbon by Vis-NIR spectra. Geoderma 2018, 314, 262–274. [Google Scholar] [CrossRef]
- Ward, K.J.; Chabrillat, S.; Neumann, C.; Foerster, S. A remote sensing adapted approach for soil organic carbon prediction based on the spectrally clustered LUCAS soil database. Geoderma 2019, 353, 297–307. [Google Scholar] [CrossRef]
- Apinantanakon, W.; Sunat, K.; Kinmond, J.A. Optimal data division for empowering artificial neural network models employing a modified M-SPXY algorithm. Eng. Appl. Sci. Res. 2019, 46, 276–284. Available online: https://ph01.tci-thaijo.org/index.php/easr/article/view/184408 (accessed on 8 March 2025).
- Gourvénec, S.; Capron, X.; Massart, D.L. Genetic algorithms (GA) applied to the orthogonal projection approach (OPA) for variable selection. Anal. Chim. Acta 2004, 519, 11–21. [Google Scholar] [CrossRef]
- Menze, B.H.; Kelm, B.M.; Masuch, R.; Himmelreich, U.; Bachert, P.; Petrich, W.; Hamprecht, F.A. A comparison of random forest and its Gini importance with standard chemometric methods for the feature selection and classification of spectral data. BMC Bioinform. 2009, 10, 213. [Google Scholar] [CrossRef]
- Esmaeili, M.; Abbasi-Moghadam, D.; Sharifi, A.; Tariq, A.; Li, Q. Hyperspectral image band selection based on CNN embedded GA (CNNeGA). J. Sel. Top. Appl. Earth Obs. Remote Sens. 2023, 16, 1927–1950. [Google Scholar] [CrossRef]
- Li, S.; Wu, H.; Wan, D.; Zhu, J. An effective feature selection method for hyperspectral image classification based on genetic algorithm and support vector machine. Knowl.-Based Syst. 2011, 24, 40–48. [Google Scholar] [CrossRef]
- Ben-Dor, E. Quantitative remote sensing of soil properties. Adv. Agron. 2002, 75, 173–243. [Google Scholar] [CrossRef]
- Su, X.; Yan, X.; Tsai, C.L. Linear regression. Wiley Interdiscip. Rev. Comput. Stat. 2012, 4, 275–294. [Google Scholar] [CrossRef]
- Salehi, B.; Mireei, S.A.; Jafari, M.; Hemmat, A.; Majidi, M.M. Integrating in-field Vis-NIR leaf spectroscopy and deep learning feature extraction for growth-stage dependent and independent genoty of wheat plants. Biosyst. Eng. 2024, 238, 188–199. [Google Scholar] [CrossRef]
- Ma, Z.; Zhang, H.; Liu, J. MM-RNN: A multimodal RNN for precipitation nowcasting. IEEE Trans. Geosci. Remote Sens. 2023, 61, 1–14. [Google Scholar] [CrossRef]
- Koutnik, J.; Greff, K.; Gomez, F.; Schmidhuber, J. A clockwork rnn. In Proceedings of the International Conference on Machine Learning, Beijing, China, 22–24 June 2014; pp. 1863–1871. [Google Scholar] [CrossRef]
- Terrault, N.A.; Hassanein, T.I. Management of the patient with, SVR. J. Hepatol. 2016, 65, S120–S129. [Google Scholar] [CrossRef] [PubMed]
- Bonat, W.H.; Kokonendji, C.C. Flexible Tweedie regression models for continuous data. J. Stat. Comput. Simul. 2017, 87, 2138–2152. [Google Scholar] [CrossRef]
- Wang, K.; Gou, C.; Duan, Y.; Lin, Y.; Zheng, X.; Wang, F.Y. Generative adversarial networks: Introduction outlook. J. Autom. Sin. 2017, 44, 588–598. [Google Scholar] [CrossRef]
- Creswell, A.; White, T.; Dumoulin, V.; Arulkumaran, K.; Sengupta, B.; Bharath, A.A. Generative adversarial networks: An overview. Signal Process. Mag. 2018, 35, 53–65. [Google Scholar] [CrossRef]
- Tschannen, M.; Bachem, O.; Lucic, M. Recent advances in autoencoder-based representation learning. arXiv 2018, arXiv:1812.05069. [Google Scholar] [CrossRef]
- Wang, J.; Lu, S.; Wang, S.-H.; Zhang, Y.-D. A review on extreme learning machine. Multimed. Tools Appl. 2022, 81, 41611–41660. [Google Scholar] [CrossRef]
- Bergstra, J.; Bardenet, R.; Bengio, Y.; Kégl, B. Algorithms for hyper-parameter optimization. In Proceedings of the NIPS’11: Proceedings of the 25th International Conference on Neural Information Processing System, Granada, Spain, 12–15 December 2011; Available online: https://dl.acm.org/doi/10.5555/2986459.2986743 (accessed on 10 March 2025).
- Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. Available online: https://dl.acm.org/doi/10.5555/2188385.2188395 (accessed on 10 March 2025).
- Clifton, J.; Laber, E. Q-learning: Theory and applications. Annu. Rev. Stat. Its Appl. 2020, 7, 279–301. [Google Scholar] [CrossRef]
- Hinich, M.J. A model for a self-adapting filter. Inf. Control 1962, 5, 185–203. [Google Scholar] [CrossRef]
- Xu, C.; Xu, C.; Wu, C.; Qu, D.; Liu, J.; Wang, Y.; Shao, G. A novel self-adapting filter based navigation algorithm for autonomous underwater vehicles. Ocean Eng. 2019, 187, 106146. [Google Scholar] [CrossRef]
- Vilalta, R.; Drissi, Y. A perspective view and survey of meta-learning. Artif. Intell. Rev. 2002, 18, 77–95. [Google Scholar] [CrossRef]
- Wang, F.; Li, J.; Li, Z.; Ke, D.; Du, J.; Garcia, C.; Rodriguez, J. Design of model predictive control weighting factors for PMSM using Gaussian distribution-based particle swarm optimization. Trans. Ind. Electron. 2021, 6911, 10935–10946. [Google Scholar] [CrossRef]
- Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. arXiv 2014, arXiv:1412.6980. [Google Scholar] [CrossRef]
- Abikoff, W. The uniformization theorem. Am. Math. Mon. 1981, 88, 574–592. [Google Scholar] [CrossRef]
- Khoshgoftaar, T.M.; Golawala, M.; Van Hulse, J. An empirical study of learning from imbalanced data using random forest. Int. Conf. Tools Artif. Intell. 2007, 2, 310–317. [Google Scholar] [CrossRef]
- Dietterich, T.G. Ensemble learning. In The Handbook of Brain Theory and Neural Networks, 2nd ed.; Arbib, M.A., Ed.; MIT Press: Cambridge, MA, USA, 2002; pp. 405–408. [Google Scholar]
- Hussein, F.; Kharma, N.; Ward, R. Genetic algorithms for feature selection and weighting, a review and study. In Proceedings of the Sixth International Conference on Document Analysis and Recognition, Seattle, WA, USA, 13 September 2001; pp. 1240–1244. [Google Scholar] [CrossRef]
- Ericsson, M.; Resende, M.; Pardalos, P. Agenetic algorithm for the weight setting problem in OSPFrouting. J. Comb. Optim. 2002, 6, 299–333. [Google Scholar] [CrossRef]
- Beck, J.; Vuorio, R.; Liu, E.Z.; Xiong, Z.; Zintgraf, L.; Finn, C.; Whiteson, S. A Survey of Meta-Reinforcement Learning. arXiv. 2023. Available online: https://arxiv.org/html/2301.08028v3 (accessed on 18 March 2025).
- Kang, S.; Hwang, D.; Eo, M.; Kim, T.; Rhee, W. Meta-learning with a geometry-adaptive preconditioner. In Proceedings of the Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 16080–16090. [Google Scholar] [CrossRef]
- Amin, A.; Adnan, A.; Anwar, S. An adaptive learning approach for customer churn prediction in the telecommunication industry using evolutionary computation and Naïve Bayes. Appl. Soft Comput. 2023, 137, 110103. [Google Scholar] [CrossRef]
- Tang, Y.; Dai, Q.; Yang, M.; Du, T.; Chen, L. Software defect prediction ensemble learning algorithm based on adaptive variable sparrow search algorithm. Int. J. Mach. Learn. Cybern. 2023, 14, 1967–1987. [Google Scholar] [CrossRef]
- Gerard, D.; Indra, A. A stacked regression ensemble approach for the quantitative determination of biomass feedstock compositions using near infrared spectroscopy. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2022, 276, 121231. [Google Scholar] [CrossRef]
- Djarum, D.H.; Ahmad, Z.; Zhang, J. Reduced Bayesian Optimized Stacked Regressor (RBOSR): A highly efficient stacked approach for improved air pollution prediction. Appl. Soft Comput. 2023, 144, 110466. [Google Scholar] [CrossRef]
- Afape, J.O.; Willoughby, A.A.; Sanyaolu, M.E.; Obiyemi, O.O.; Moloi, K.; Jooda, J.O.; Dairo, O.F. Improving millimetre-wave path loss estimation using automated hyperparameter-tuned stacking ensemble regression machine learning. Results Eng. 2024, 22, 102289. [Google Scholar] [CrossRef]
- Xing, Y.; Sun, Y.; Zhou, X.; Xiu, Z. A novel self-attention mechanism-based machine learning model for high-accuracy prediction of CO2 solubility in natural deep eutectic solvents. J. Environ. Manag. 2025, 393, 127275. [Google Scholar] [CrossRef]
- Wahid, A.; Yahya, M.; Breslin, J.G.; Intizar, M.A. Self-Attention Transformer-Based Architecture for Remaining Useful Life Estimation of Complex Machines. Procedia Comput. Sci. 2023, 217, 456–464. [Google Scholar] [CrossRef]
- Rossel, R.A.V.; Shen, Z.; Lopez, L.R.; Behrens, T.; Shi, Z.; Wetterlind, J.; Sudduth, K.A.; Stenberg, B.; Guerrero, C.; Gholizadeh, A.; et al. An imperative for soil spectroscopic modelling is to think global but fit local with transfer learning. Earth-Sci. Rev. 2024, 254, 104797. [Google Scholar] [CrossRef]










| Algorithm | Hyper-Parameter | |||||
|---|---|---|---|---|---|---|
| Estimator | Criterion | Max_Depth | Min_Samples_Split | Min_Samples_Leaf | Learning_Rate | |
| RT | \ | mse | 4 | 2 | 2 | \ |
| RF | 770 | mse | 2 | 2 | 3 | \ |
| GBRT | 560 | mse | 4 | 2 | 2 | 0.1 |
| AdaBoost | 480 | mse | 4 | \ | \ | 0.1 |
| XGBoost | 190 | mse | 3 | \ | \ | 0.2 |
| LightGBM | 130 | mse | 4 | \ | \ | 0.05 |
| Extra Trees | 330 | mse | 5 | 3 | 2 | 0.1 |
| HGBR | 400 | mae | 5 | 2 | 2 | 0.2 |
| catboost | 190 | mse | 3 | \ | \ | 0.1 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Yin, K.; Deng, J.; Li, H.; Feng, C.; Peng, J. A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction. Sensors 2026, 26, 195. https://doi.org/10.3390/s26010195
Yin K, Deng J, Li H, Feng C, Peng J. A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction. Sensors. 2026; 26(1):195. https://doi.org/10.3390/s26010195
Chicago/Turabian StyleYin, Keyang, Jia Deng, Huixia Li, Chunhui Feng, and Jie Peng. 2026. "A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction" Sensors 26, no. 1: 195. https://doi.org/10.3390/s26010195
APA StyleYin, K., Deng, J., Li, H., Feng, C., & Peng, J. (2026). A Novel Self-Attention Mechanism-Based Dynamic Ensemble Model for Soil Hyperspectral Prediction. Sensors, 26(1), 195. https://doi.org/10.3390/s26010195

