in

A novel approach to soil nutrients prediction model for Bezuidenhout Park, Johannesburg, Gauteng Province, South Africa: attention temporal neural networks (ATNN)


Abstract

The agricultural sector is moving from the Agriculture 4.0 model to the Agriculture 5.0 model because of advances in machine learning (ML), big data, and remote sensing. The purpose of this study is to introduce and validate a novel Attention Temporal Neural Network (ATNN) framework for the high-resolution prediction of soil nutrient concentrations, demonstrating its practical value using a real-world Digital Soil Mapping (DSM) dataset from Bezuidenhout Park, Johannesburg. The ATNN framework explicitly models temporal and contextual dependencies in multisource predictors, which include a Digital Elevation Model (DEM), spectral indices from Landsat and Sentinel-2 imagery, and meteorological covariates. The method involves combining the deep feature extraction capabilities of the ATNN with the strength of gradient-boosting regressors, specifically XGBoost, to leverage both architectures for robust tabular regression. The resulting ATNN–XGBoost hybrid model delivered the best performance in the experiments. It significantly reduced prediction error and improved agreement with laboratory measurements, achieving, for example, an RMSE ≈ 1.98 ppm, MAPE ≈ 2.81%, CCC ≈ of 0.76, and R2 ≈ of 0.69 for aluminium. This approach materially improved nutrient estimation accuracy over baseline models, including Random Forest (RF), Gradient Boosting (GB), and AdaBoost (ADB). The key contributions to this work are threefold: (1) the development of a compact ATNN architecture tailored for soil nutrient time series and spatial covariates; (2) a practical hybridisation strategy that pairs attention-based feature encoding with XGBoost (XGB); and (3) an empirical demonstration of superior performance on a real South African DSM dataset. These advances support more accurate and timely fertiliser management, offering a scalable path towards smarter, more sustainable precision agriculture systems.

Similar content being viewed by others

Agentic AI-driven autonomous decision support system for smart agriculture

Interpretable deep learning models for independent fertilizer and crop recommendation

An evaluation of machine learning for soil analysis in internet of things-enabled smart farming

Abbreviations

AI:

Artificial intelligence

ACO:

Ant colony optimisation

AdaBoost or ADB:

Adaptive boosting

ATNN:

Attention temporal neural network

API:

Application programming interface

CCC:

Concordance correlation coefficient

CP:

Correlation plot

DEM:

Digital elevation model

DT:

Decision tree

DP:

Deep learning

EDA:

Exploratory data analysis

EA:

Evolutionary algorithm

GB:

Gradient boost

GIS:

Geographic information system

IR:

Infrared ray

LR:

Linear regression

LST:

Land surface temperature

MAE:

Mean absolute error

MAPE:

Mean percentage error

MIRAS:

Microwave imaging radiometer using aperture synthesis

MSE:

Mean square error

ML:

Machine learning

NDVI:

Normalised difference vegetation index

OLI:

Operational land imager

OLS:

Ordinary least squares

PCA:

Principal component analysis

RF:

Random forest

RGB:

Red–green–blue

RMSE:

Root mean square error

R2
:

R-squared (coefficient of determination)

SMOS:

Soil moisture and ocean salinity

SOC:

Soil organic carbon

SRTM:

Shuttle radar topography mission

SWI:

Short-wave infrared

TIRS:

Thermal infrared sensor

UTC:

Coordinated universal time

UV:

Ultraviolet

XGB:

Extreme gradient boosting

Funding

This research did not receive funding.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to
Bamidele A. Dada or Nnamdi I. Nwulu.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary Information. (download DOCX )

Appendix I: ATNN architecture and training specifications

Appendix I: ATNN architecture and training specifications

Parameter

Value

Notes

Model variant

Attention temporal neural network (ATNN)

Temporal encoder with attention mechanism

Number of encoder layers

4

Stacked attention-based encoder blocks

Hidden dimension (d_model)

128

Embedding and attention projection size

Feed-forward dimension (d_ff)

512

Inner FFN layer size

Number of attention heads

4

Multi-head self-attention

Sequence length

12

Temporal timesteps per input sequence

Dropout rate

0.20

Applied in attention and FFN layers

Activation function

GELU

Non-linear activation in FFN

Batch size

64

Mini-batch size

Training epochs

150

With early stopping

Optimiser

AdamW

Adaptive optimiser with weight decay

Learning rate

1e-4

Initial learning rate

Weight decay

1e-5

Regularisation parameter

Learning rate scheduler

ReduceLROnPlateau

Factor = 0.5, patience = 5

Loss function

Mean squared error (MSE)

Regression loss

Early stopping

Yes (patience = 15)

Validation-based stopping

Gradient clipping

1.0

L2 norm clipping

Random seed

42

Ensures reproducibility

Data normalisation

StandardScaler

Fitted on training data only

Train/validation/test split

70% / 15% / 15%

Spatial block sampling

Framework

PyTorch

Version ≥ 1.10

Hardware

Single GPU (≥ 16 GB VRAM)

CPU supported but slower

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.

Reprints and permissions

About this article

Cite this article

Dada, B.A., Nwulu, N.I. & Olukanmi, S.O. A novel approach to soil nutrients prediction model for Bezuidenhout Park, Johannesburg, Gauteng Province, South Africa: attention temporal neural networks (ATNN).
Sci Rep (2026). https://doi.org/10.1038/s41598-026-56150-z

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1038/s41598-026-56150-z

Keywords

  • Soil nutrient prediction
  • Digital soil mapping
  • ATNN-XGB
  • Soil nutrient management
  • Agriculture 5.0
  • ML


Source: Ecology - nature.com

The variability fingerprint of a warming world informing climate risk and solutions

Enhanced cellular polyamine pools induced by different nitrogen substrates modify silicification of diatom Paralia sulcata

Back to Top