Abstract
This paper proposes a hybrid, interpretable machine learning framework for the preliminary screening of soil macronutrients using Sentinel-2 and AgroLens data. This study aims not to replace laboratory analysis, but to test the feasibility of obtaining a useful proxy signal for estimating nitrogen (N), phosphorus (P), and potassium (K) content using a limited set of remote sensing and agricultural features. The developed pipeline includes data auditing, leakage control, feature engineering, train-only normalization, group-aware partitioning, baseline/SOTA model comparison, hybrid regression modeling, SHAP interpretation, and uncertainty assessment. The experiment used 4471 AgroLens observations and 126 features derived from Sentinel-2 spectral aggregates, vegetation indices, temporal characteristics, and crop-related parameters. The evaluation indicated that the proposed approach consistently improves forecasting quality relative to baseline models under reduced-input conditions. Linear relationships between target variables ranged from 0.14 to 0.17, while nonlinear relationships reached 0.23. SHAP analysis revealed significant contributions from vegetation indices, crop-specific interactions, and Sentinel-2 spectral channels. The findings support the applicability of the proposed framework for preliminary monitoring, prioritizing field surveys, and decision support in digital agriculture. Although an additional AgroLens control segment was used to assess the robustness of the study, the study did not include independent external validation of the data collected across different geographic or agro-climatic conditions.
1. Introduction
Accurate determination of soil macronutrient content is a critical challenge in modern digital agriculture, as nitrogen (N), phosphorus (P), and potassium (K) directly impact soil fertility, crop yield, and the effectiveness of agricultural management practices [1]. Traditional laboratory analysis remains the most reliable method for determining soil chemistry; however, it requires significant resources associated with field sampling, transportation, laboratory processing, and expert analysis [2]. As agricultural monitoring increasingly expands to larger spatial scales, interest in computational methods capable of supporting rapid preliminary assessment and decision-making in precision agriculture is growing [3].
While N, P, and K are commonly grouped as the main soil macronutrients, they differ significantly in their agronomic functions and the mechanisms by which they can be reflected in remote sensing observations. Nitrogen is closely linked to chlorophyll synthesis, canopy development, and photosynthetic activity, making its impact more easily observable through vegetation growth rate and red-edge spectral signatures. Phosphorus primarily influences root development, energy transfer, and early plant growth processes, often resulting in weaker and less direct spectral signatures at the canopy level. Potassium plays a critical role in water regulation, osmotic balance, stress tolerance, and stomatal function, creating indirect links with moisture-sensitive spectral signatures, particularly in the near-infrared (NIR) and shortwave infrared (SWIR) ranges. Therefore, N, P, and K should not be expected to exhibit equal predictability based on remote sensing data, as each nutrient influences vegetation and soil processes through different physical and biological pathways.
Recent advances in remote sensing and artificial intelligence technologies have significantly expanded the capabilities of agricultural analytics [4]. Among the currently available Earth observation platforms, Sentinel-2 has gained particular significance because it provides high spatial resolution (10–20 m), frequent flyby cycles, open access, and multispectral observations suitable for vegetation and land surface monitoring [5]. The Sentinel-2 mission is widely applied in agricultural research for vegetation assessment, crop condition monitoring, biomass estimation, drought assessment, and precision agriculture applications [6]. In particular, the red edge, near-infrared (NIR), and shortwave infrared (SWIR) spectral bands provide valuable information on vegetation condition, canopy structure, and moisture dynamics, making Sentinel-2 an attractive platform for scalable agricultural monitoring and decision support systems.
However, satellite observations do not directly measure soil chemistry. Instead, they capture indirect manifestations of nutrient availability through their effects on vegetation health, crop development, and surface characteristics [7,8]. Therefore, remote sensing-based nutrient assessment should be viewed as an indirect screening task aimed at identifying statistically significant nutrient-related signals, rather than as a replacement for laboratory soil analysis.
Modern research is increasingly employing machine learning approaches for soil property assessment and agroecological modeling [9]. Ensemble methods and gradient boosting algorithms, including Random Forest, XGBoost, CatBoost, and LightGBM, have demonstrated high performance in heterogeneous agricultural datasets due to their ability to capture nonlinear relationships between variables [10]. At the same time, explainable artificial intelligence is attracting increasing attention, as practical agricultural applications require not only predictive performance but also transparent and interpretable decision-making processes [11]. In this context, SHAP-based interpretation has become one of the most widely used approaches for quantifying feature contributions and improving model transparency [12].
One of the most comprehensive publicly available resources for remote sensing-based soil analysis is the AgroLens dataset, which combines Sentinel-2 observations, agro-spatial variables, and laboratory soil measurements [13]. The original AgroLens framework utilizes an expanded feature space, incorporating weather information, additional spatial variables, and multivariate embeddings [14]. While such approaches can improve prediction accuracy, they also pose challenges related to computational complexity, dependence on external data sources, and decreased reproducibility in real-world agricultural settings.
Several recent studies have reported promising results for remotely sensed-based soil property prediction; however, important methodological limitations remain. Many published approaches rely on extensive feature spaces that combine spectral, meteorological, environmental, and spatial variables, hindering reproducibility and practical application [15]. Furthermore, in a number of studies, feature selection, normalization, or hyperparameter optimization are performed before the final data splitting process, increasing the risk of information leakage and overly optimistic performance estimates [16]. Ensemble and deep learning models are also often viewed as “black-box” predictors, providing limited insight into the contribution of individual variables and reducing interpretability for agronomic decision-making [17]. Furthermore, the added value of increasingly complex architectures is often assessed without considering computational efficiency, transparency, and robustness under reduced input data [18,19]. These limitations motivate the development of leakage-controlled, interpretable, and reproducible frameworks capable of working with the limited but practically applicable Sentinel-2 dataset and agro-spatial features [20].
A review of the current literature reveals several unresolved issues. First, many studies implicitly position remote sensing models as a replacement for laboratory analysis, potentially creating unrealistic expectations regarding achievable predictive accuracy [21]. Second, leaky preprocessing, strict separation of training and test sets, and transparent model selection procedures are not always explicitly addressed [22]. Third, reduced-input scenarios that avoid dependence on multiple external data sources remain relatively underexplored, despite their practical importance for scalable digital agricultural systems [23].
To address these issues, this study proposes AgroNPK-GATE, a hybrid machine learning framework with leaky control and interpretability for soil macronutrient proxy screening using Sentinel-2 and AgroLens data. Unlike traditional ensemble approaches that combine multiple base models through a separate metamodel, AgroNPK-GATE uses a supervised residual adjustment strategy specifically designed for nutrient estimation with reduced input data [24,25,26]. The system integrates leak-controlled pre-processing, validation-based residue filtering, SHAP interpretation, and uncertainty quantification into a single, repeatable workflow.
The primary goal of this study is not to replace laboratory soil analysis or achieve laboratory-based nutrient assessment. Instead, the proposed framework aims to identify reliable nutrient-related signals that can support pre-farm monitoring, field prioritization, and agronomic decision-making. The scientific contribution lies in the integration of hybrid modeling, uncertainty-based assessment, interpretability analysis, and leakage management methodology within a single framework with reduced input data. From a practical perspective, this approach can help reduce monitoring costs, improve the efficiency of soil sampling campaigns, support targeted fertilizer management, and facilitate the application of precision farming practices in settings with limited data availability.
The remainder of the paper is organized as follows. Section 2 describes the AgroLens dataset, feature engineering procedures, and the leakage management pre-processing strategy. Section 3 presents the AgroNPK-GATE architecture, experimental evaluation, uncertainty analysis, and interpretability assessment. Finally, the conclusions summarize the main results, discuss the limitations of the study, and outline directions for future research.
2. Materials and Methods
This section discusses methods for data preparation, feature space construction, and computational pipeline development for the preliminary prediction of soil macronutrients N, P, and K using Sentinel-2 and AgroLens data. Particular attention is paid to leakage-controlled preprocessing, reduced-input strategies, correct sample separation, spectral and agro-spatial feature engineering, and the construction of an interpretable hybrid model for proxy-screening tasks in digital agriculture.
2.1. Data Preparation
The experiments in this study were conducted using the AgroLens dataset, openly published in the Zenodo repository (https://zenodo.org/records/15100427) (accessed on 15 March 2026). Data preparation is a critical step in building robust machine learning models, especially in remote sensing of soil characteristics, where there is a risk of information leakage, distributional heterogeneity, and the influence of extreme observations. In this study, the preprocessing process was organized as a leakage-controlled pipeline, including auditing the initial AgroLens dataset, generating a reduced-input feature space, group-aware data partitioning, and train-only feature processing before model training. To ensure reproducibility, all experiments were conducted using the publicly available AgroLens dataset as an immutable data source. The full workflow was run using fixed random seeds (global random state = 42; main experiment seed = 20,260,525) and a group-aware split strategy based on POINTID/group_id. The data was split into training ( = 2681), validation ( = 671), first holdout test ( = 448), and second holdout AgroLens parts ( = 671) using GroupShuffleSplit, with zero group overlap between parts. All preprocessing operations, including imputation, scaling, winsorization, and feature engineering rules, were applied exclusively to the training part and then unchanged for the remaining parts. The validation part was used only for model and hyperparameter selection, while the test and second holdout parts were reserved exclusively for final evaluation.
Figure 1 shows the data preparation logic before model training: from auditing the initial AgroLens dataset to generating a model-ready table with 4471 observations and 126 predictors. This diagram reflects not only technical data processing but also a leakage-controlled pipeline necessary for the proper experimental validation of machine learning models. The first step is to read-only load the initial data, treating the initial AgroLens table as an immutable source. It stores the laboratory target variables N, P, and K, as well as source features associated with Sentinel-2 spectral aggregates, crop type, survey dates, and additional service fields. This approach is important for reproducibility: the source dataset is not directly modified, and all subsequent transformations are performed as separate, controlled operations. Next, a data audit is performed, and the modeling domain is fixed. At this stage, the table schema, gaps, duplicates, target variable distributions, crop coverage, and the correctness of the target space are checked. Particular attention is paid to identifying prohibited features. N, P, K, pH values, POINTID, sample_id, group_id, raw dates, and other fields that could lead to target information leakage or artificially inflate the model’s quality are excluded as operational predictors. This step is crucial, as the goal of the study is not to restore target values through hidden identifiers, but to verify the usefulness of available remote and agro-spatial features.
Figure 1.
Data preparation and feature engineering framework for reduced-input prediction of N, P, and K using AgroLens.
Next, a group split of the data was performed in AgroLens into training, validation, test, and a second control group. The split was based on disjoint POINTID groups: 2681 observations were used for training, 671 for validation, 448 for testing, and 671 for an additional robustness assessment. The validation group was used for model selection and hyperparameter tuning, while the test and second control groups remained completely isolated from all training, tuning, residual threshold selection, and calibration procedures. Although the second control group was not used during model development, it was obtained from the same AgroLens source and should therefore be interpreted as an additional robustness assessment rather than an independent external dataset for validation. The next block concerns feature engineering. From Sentinel-2 spectral channels, 12 base features are formed, supplemented by 19 vegetation, water, and red-edge indices, 9 temporal descriptors, 50 agro-spatial features, and 36 gap indicators. Spectral indices, including NDVI and EVI, are corrected separately to ensure the features reflect physically interpretable relationships between the channels. The agriculture is represented by one-hot crop traits and crop-index interactions, allowing differences in spectral behavior across vegetation types to be accounted for. The final stage is train-only preprocessing. Normalization and winsorization parameters are calculated only on the training set; continuous features are constrained to 0.5% and 99.5% quantiles, and then the same parameters are applied to the validation, test, and external-style holdout within AgroLens. Target variables are not clipped and are not used in feature processing. The result is a model-ready feature matrix and a target N/P/K matrix, suitable for subsequent training, model comparison, ablation analysis, and result interpretation.
Conceptual mathematical model of data preparation. Let the original AgroLens dataset be denoted as follows (1):
where is one observation associated with a soil sample, Sentinel-2 spectral features, agricultural, and laboratory target values. For each observation, a target vector is generated (2):
where is the nitrogen content, is the phosphorus content, and is the potassium content. The input feature space is constructed from five main groups (3):
where is 12 Sentinel-2 spectral units.
where are vegetation, water and red-edge indices.
where are time descriptors, including cyclic representations of the month, day of the year, and the difference between the shooting and survey dates.
where are agro-spatial features, including one-hot coding of crops and crop-index interactions.
where are the gap indicators and service features of data availability. The final feature vector is defined as follows (8):
where is a feature engineering function combining spectral channels, indices, temporal characteristics, agro-environmental variables, and gap indicators. Forbidden features are excluded before training (9):
After excluding prohibited variables, the final model-available matrix has the form (10):
The data are divided into four non-overlapping samples (11):
where is the training set, is the validation set, is the test set, and is the external-style holdout within AgroLens. To control for group overlaps, the following condition is used (12):
Winsorization parameters are calculated only on the training sample (13):
where and are the lower and upper quantiles of the feature , calculated using only . For each split , the same train-fitted transform is applied (14):
where (⋅) is a transformation whose parameters were determined exclusively on the training set. The final model-ready data structure is defined as follows (15):
where is the split membership of an observation, and is the group identifier used only to control for splitting, not as a predictor. Thus, the prepared data matrix provides a correct basis for subsequent model training (16):
where is the trained prediction model, and is the predicted vector of soil macronutrients.
The detailed structure of the AgroLens dataset’s input variables, including data types, missing values, and unique values, is presented in the Supplementary Materials (Table S1). Analysis of the input table revealed the presence of missing values in the SURVEY_DATE and SENTINEL_DATE calendar fields. At the same time, the Sentinel-2 spectral aggregates do not contain missing values and form a more robust basis for further construction of the reduced-input feature space. Table 1 presents the descriptive statistics for the three target variables in the multi-objective regression problem: nitrogen (N), phosphorus (P), and potassium (K) content. For each target variable, 4471 observations are available, confirming the completeness of the target matrix and allowing model training without additional masking of individual N, P, and K values. Distribution analysis reveals a pronounced right-sided asymmetry, with mean values significantly exceeding median values, particularly for phosphorus and potassium. The greatest variability is observed for potassium, with a median of 196.9 and a maximum of 2364.2. This indicates the presence of rare but significantly different observations that can significantly affect the error margins of regression models, especially for metrics sensitive to large deviations. The results indicate that predicting N, P, and K should not be interpreted as a direct reconstruction of laboratory measurements. A more appropriate formulation of the problem is a proxy-screening approach, in which the model is used to identify a common predictive signal and preliminarily prioritize agricultural plots.
Table 1.
Descriptive statistics of target variables N, P and K.
A second validation sample of AgroLens data was used as an additional robustness assessment and was not involved in model training, hyperparameter selection, residual window tuning, or uncertainty calibration. The results indicate consistent performance within the adopted evaluation protocol. However, this sample was obtained from the same AgroLens data source and, therefore, should not be interpreted as an independent external dataset for validation. Overall, the leakage-controlled preprocessing ensured the formation of a stable, reproducible feature space for subsequent training and comparative model analysis. The implemented pipeline allowed for the integration of Sentinel-2 spectral aggregates, vegetation-water indices, temporal characteristics, and crop-type-related features, while maintaining correct data separation and preventing information leakage between samples. The resulting model-ready data matrix provides a sound basis for constructing a hybrid machine learning framework, assessing forecast quality, analyzing robustness, and interpreting results in the preliminary screening of soil macronutrients.
2.2. Leakage-Controlled Preprocessing and Exploratory Data Analysis
The main goal of this stage was to test the robustness of the feature space, analyze the structure of missing values, the distributions of target variables, and extreme observations, and assess the information content of spectral, temporal, and agro-spatial features. Additionally, linear, nonlinear, and informational relationships between features and the target variables N, P, and K were assessed. Such analysis is necessary to form a physically consistent and computationally stable reduced-input space suitable for the subsequent construction of interpretable machine learning models.
Table 2 summarizes missing values and the availability of derived features. The analysis indicates that the majority of missing values are concentrated in the original calendar fields SURVEY_DATE and SENTINEL_DATE, as well as in their transformed parsed versions. However, the derived temporal variables, including SURVEY_SENTINEL_DAY_DIFF, SURVEY_MONTH, SURVEY_DOY, SENTINEL_MONTH, and SENTINEL_DOY, do not contain missing values. This indicates that additional processing of calendar information was performed within the preprocessing pipeline, preserving the temporal structure of observations in a form suitable for further modeling. The spectral-vegetation features MSAVI2 and NBR deserve special attention, as they exhibit 0% missing values and a high number of unique values. This observation suggests their potential informativeness in analyzing spectral-vegetation relationships and generating a reduced-input feature space for preliminary assessment of soil macronutrient content.
Table 2.
Summary of omissions and availability of derived features.
The table confirms that data preparation was not limited to removing problematic columns but also aimed to preserve informative derived features while ensuring their availability. This is important for a reduced-input setup, where each retained feature must have a practical and computational justification.
The results of duplicate and POINTID uniqueness checks are presented in the Supplementary Materials (Table S2). The audit confirmed the absence of duplicate records and ID overlaps, ensuring the correctness of subsequent group-aware data partitioning and reducing the risk of artificially inflating model quality due to the recurrence of identical observations across different samples. The distribution of observations by crop type is presented in the Supplementary Materials (Table S3). The distribution highlights significant heterogeneity among crop categories: the majority of the sample consists of common_wheat, barley, and maize, while significantly fewer observations represent individual categories. This feature was taken into account when forming agro-spatial features and subsequently interpreting the modeling results, as category imbalances can affect the robustness of forecasting for different crop types.
A summary of the train/validation/test/external-style partitioning of the AgroLens dataset is provided in the Supplementary Materials (Table S4). The group-aware partitioning ensures that samples do not overlap at the identifier level and maintains close distributions of the target variables N, P, and K across the main data parts. This design minimizes the risk of information leakage and ensures a correct assessment of the models’ generalization ability within the leakage-controlled experimental protocol.
A validation of the spectral indices is presented in the Supplementary Materials (Table S5). Comparison of the original and recalculated values revealed indices with physically incorrect ranges, including EVI, SAVI, and MSAVI2, and their recalculated versions were included in the feature space. Table S5 further explains the use of *_mean9 aggregates, calculated as the mean values of Sentinel-2 spectral bands within a 3 × 3-pixel window centered on a soil sample point. This approach improves the robustness of distance-based features and ensures a more accurate formation of the reduced-input space for estimating N, P, and K.
Table 3 presents winsorization bounds for 12 Sentinel-2 spectral aggregates, calculated exclusively using the training set. The lower and upper bounds correspond to the 0.5% and 99.5% quantiles, respectively. This procedure was used to constrain extreme values of spectral features without removing observations from the dataset. Calculating the bounds only on the training set ensures the correctness of the preprocessing pipeline. It eliminates the use of information from the test and external-style holdout within AgroLens when adjusting the transformations. For bands B01 and B02, the lower bound is zero, so the lower bound was not applied. For the remaining bands, the lower bound was set to 17–21 observations. Upper limits were applied to all bands, with the highest number of upper limits observed for B07, B08, and B8A, where 35–37 high values were processed. The observed distributions indicate that the near-infrared and red-edge bands exhibit more pronounced upper tails in their distributions. Using train-only winsorization ensures robust spectral feature generation and preserves the independence of the evaluation samples.
Table 3.
Train-only winsorization bounds for Sentinel-2 spectral aggregates.
The model families and their role in the experimental comparison are presented in the Supplementary Materials (Table S6). In the main body of the article, it is sufficient to note that the comparison included naive baselines, linear models, bagging ensembles, boosting models, neural network architectures, and the proposed residual-gated hybrid approach. This experimental design ensures a proper comparison of AgroNPK-GATE not with a single model, but with several classes of methods that reflect different levels of complexity and types of dependencies in the tabular reduced-input feature space. The distributions of the target variables N, P, and K are also presented in the Supplementary Materials (Figure S1). The histograms show right skewness and the presence of rare high values for all three macronutrients, especially K. These results confirm the heterogeneity of the target matrix and justify the use of robust regression models, normalized metrics, and additional analysis of the impact of extreme observations.
Figure 2 shows the differences in the distributions of the target variables N, P, and K across scales, interquartile ranges, and numbers of extreme observations. The most compact distribution is observed for nitrogen, where the majority of values are concentrated within a relatively narrow range. Phosphorus shows a wider interquartile range and more outliers, indicating significant heterogeneity in this variable. Potassium exhibits the highest variability. This variable has a wide range of values, a significant number of high outliers, and a larger physical scale compared to N and P. These observations suggest that the target variables differ in predictive complexity, so subsequent modeling should account for differences in scale, degree of dispersion, and the influence of extreme observations.
Figure 2.
Boxplots of target variables N, P, and K in the AgroLens dataset.
Pairwise relationships between the target variables N, P, and K are presented in the Supplementary Materials (Figure S2). The analysis reveals the absence of a pronounced linear relationship among the macronutrients, as well as asymmetric distributions and individual extreme observations, particularly for K. These results confirm that N, P, and K should be considered as independent but jointly analyzed target variables in the multi-objective regression framework. The distribution of observations by crop type is additionally presented in the Supplementary Materials (Figure S3). The analysis confirms the pronounced heterogeneity of crop categories: the majority of the sample consists of common_wheat, barley, and maize, while a limited number of observations represent individual categories. This feature was taken into account when interpreting the modeling results and analyzing the robustness of the predictions for different crop types. Matrices of linear and nonlinear relationships between the target variables N, P, and K are presented in the Supplementary Materials (Figures S4 and S5). The obtained results demonstrate weak linear and moderately pronounced nonlinear correlations between macronutrients, confirming the need for a multi-objective regression model and the use of external spectral and agro-spatial features to predict soil characteristics. Additional analysis of the linear and nonlinear relationships between features and target variables is presented in the Supplementary Materials (Figures S6 and S7). This analysis suggests that a useful predictive signal is formed primarily through complex nonlinear interactions between Sentinel-2 spectral channels, vegetation-water indices, and agro-spatial features. At the same time, individual linear relationships remain relatively weak.
Figure 3 presents the mutual information matrix between the selected features and the target variables N, P, and K. This analysis allows one to estimate the overall information contribution of the features in explaining the variability in soil macronutrients, regardless of the nature of the relationships. The mutual-information analysis indicates that the information content of the features is unevenly distributed across the target variables. For nitrogen, the most significant values are observed for band_B05_mean9, inter_NDVI_NDMI, time_SENTINEL_MONTH_sin, band_B01_mean9, and several crop-index interactions. For phosphorus, the greatest contribution is associated with the crop_maize, cropx_crop_maize_idx_NDRE, band_B03_mean9, and cropx_crop_maize_idx_NDVI features. For potassium, the most informative are ratio_SWIR2_NIR, crop_common_wheat, crop_rye, idx_RECI, and idx_MSAVI2. The findings reveal the heterogeneous structure of the feature space and the presence of distinct groups of informative features for N, P, and K. Mutual information analysis complements correlation estimates and serves as the basis for interpreting the contribution of features in subsequent modeling.
Figure 3.
The mutual information matrix between features and target variables N, P and K.
Overall, the exploratory and preprocessing analyses confirmed that the reduced-input feature space contains measurable spectral, index, and agro-spatial signals suitable for preliminary prediction of soil macronutrients. Leakage-controlled preprocessing ensured the correct handling of missing values, limited extreme values, and maintained independence between the training and evaluation samples. The combined evidence from the linear, nonlinear, and informational analyses also showed that N, P, and K prediction relies primarily on complex indirect relationships between Sentinel-2 spectral characteristics, vegetation-water indices, and agricultural features. The resulting feature space was further used for training, comparative evaluation, and interpretation of the proposed hybrid machine learning framework.
3. Results
This section presents the results of the construction and experimental evaluation of the proposed hybrid machine learning framework for preliminary forecasting of soil macronutrients N, P, and K based on Sentinel-2 and AgroLens data. A comparative study of baseline, ensemble, gradient, and neural network models is conducted under reduced-input feature space conditions. Particular attention is paid to assessing the robustness of forecasting, the quality of generalization across validation, test, and external-style holdout within AgroLens, analyzing computational efficiency, model interpretability, and assessing forecast uncertainty.
3.1. Hybrid Modeling and Experimental Evaluation
AgroNPK-GATE differs from traditional stacking architectures in several ways. First, it does not train a separate meta-training class based on multiple base models. Second, residual correction is applied using a single residual expert, constrained by target values selected based on validation. Third, all model selection decisions, including value optimization and interval calibration, are performed exclusively on the validation set using a leakage-controlled protocol. Finally, the framework integrates prediction, uncertainty assessment, and explainability analysis into a single screening-oriented workflow.
Figure 4 shows the internal architecture of the proposed AgroNPK-GATE model, designed for preliminary screening of soil macronutrients N, P, and K based on a reduced-input feature space. The architecture implements a group-aware hybrid proxy-screening approach. It combines a regularized base model, a residual expert, a validation-selected residual gate mechanism, and a conformal interval calibration in a single computational pipeline. The model input is a feature vector comprising Sentinel-2 spectral aggregates, vegetation indices, temporal characteristics, and crop-type features. Laboratory parameters N, P, and K are not used as input features at the inference stage. The first level of the architecture is implemented as a regularized Ridge model that provides a base prediction for three target variables. The second level is a residual expert, trained on the base model’s residuals and designed to identify an additional nonlinear signal. The third level includes a residual gate mechanism, where a mixing coefficient is automatically selected for each target variable based on validation-only selection. This mechanism determines the degree to which the residual component contributes to the final forecast. The fourth level combines the baseline and residual predictions using validation-selected coefficients to produce final estimates of N, P, and K contents. The architecture also includes a conformal calibration module for calculating symmetric interval forecast boundaries. The model outputs not only point estimates of soil macronutrients but also proxy-oriented uncertainty intervals used for preliminary monitoring and prioritization of agricultural plots. The architecture adheres to leakage-controlled principles, whereby test and external-style data are not used to configure residual gates and calibration parameters.
Figure 4.
Internal architecture of the proposed hybrid approach for proxy-screening N, P, and K.
The methodological contribution of AgroNPK-GATE is not the introduction of a new residual-based learning mechanism, but the integration of supervised residual correction, validation-only breakpoint selection, uncertainty calibration, and leakage-controlled estimation into a single, reproducible system for screening soil nutrient proxy data. Ridge regression was chosen as the base model, as preliminary experiments showed that linear models provide high and stable performance in the feature space with a reduced number of inputs. ExtraTrees was then used as a residual expert to account for nonlinear interactions not explained by the linear component. This combination was chosen to provide a balance between robustness, interpretability, and predictive flexibility while avoiding the complexity of traditional multi-model stacking architectures. Targeted residual gates were introduced because the relative contribution of nonlinear information varied for N, P, and K, and therefore, a single global correction factor was deemed impractical. To complete the modeling block, the proposed hybrid architecture was implemented, aimed at combining robust linear prediction and nonlinear residual error correction. The input is a selected feature subspace (17):
The first level generates a regularized linear baseline forecast (18):
where is the Ridge backbone, trained only on . This block provides a robust baseline estimate of N, P, and K and reduces the risk of overfitting with a limited reduced-input feature space. Next, the residual error of the baseline prediction is calculated (19):
At the second level, a nonlinear residual expert is trained, which models not the target values themselves, but the residuals after the linear backbone (20):
where is the ExtraTrees residual expert. This scheme allows separating the stable linear component from the nonlinear residual dependencies. The third level introduces target-wise residual gates (21):
where each gate value determines what proportion of the residual correction is applied to the corresponding target variable. The gate coefficients were selected independently for each target variable using a grid search in the interval [0, 1] with a step size of 0.05. For each candidate value, the residual-corrected prediction was evaluated on the validation dataset, and the coefficient that minimized the target-variable-specific NRMSE was retained. The obtained values (, , ) show that the nonlinear residual correction provided an additional prediction benefit for nitrogen and potassium, whereas for phosphorus, the residual expert evaluation did not improve the validation performance compared to the baseline Ridge model. Therefore, the optimal coefficient selected for validation for phosphorus was zero, suggesting that the available input-reduced feature space contains a weaker usable nonlinear signal for P than for N and K in the current experimental setup. The final point forecast is formed as the sum of the base forecast and the weighted residual correction (22):
where denotes element-wise multiplication. This formula reflects the main idea of the proposed approach: not to completely replace the base model, but to add a nonlinear correction in a controlled manner only where it is useful according to the validation criterion. To estimate uncertainty, target-wise conformal intervals are additionally formed. For each target variable , the quantile of absolute residuals is calculated in the validation part (23):
After this, the interval for the forecast is set (24):
Thus, the proposed approach yields not only point proxy estimates of N, P, and K but also uncertainty bounds on the original scale of the target variables. The architecture remains consistent with the overall workflow: features are generated without target leakage, the backbone and residual expert are trained on a training split, the configuration is selected on a validation split, and the test and external-style parts are not involved in tuning. The proposed model aims to provide preliminary estimates of N, P, and K content in the limited AgroLens feature space, without using extended external data sources or features that could cause information leakage. The architecture generates a baseline-regularized forecast and then estimates the residual nonlinear signal and performs target-wise corrections separately for nitrogen, phosphorus, and potassium. This approach ensures reproducible and interpretable modeling, allowing for the assessment of the suitability of spectral, index, temporal, and agronomic features for reduced-input soil nutrient screening.
3.2. Experimental Evaluation and Comparative Analysis of the Proposed Framework
The focus is on comparing AgroNPK-GATE with baseline linear, ensemble, boosting, and neural network models using the macro_NRMSE, macro_MAE, and additional robustness metrics. Additionally, interval calibration, computational efficiency, robustness scenarios, subgroup performance, and the contribution of individual feature space components are analyzed through ablation studies. This approach allows us to evaluate not only the final model accuracy but also its robustness, interpretability, and practical suitability for preliminary screening of soil macronutrients. Figure 5 compares the validation performance of all evaluated models using macro_NRMSE. AgroNPK-GATE achieved the lowest error, while Ridge and ElasticNet produced very similar results. More complex neural architectures did not provide additional benefits under the reduced-input setting.
Figure 5.
Comparison of the proposed approach and comparison models on the validation sample by macro_NRMSE.
Figure 6 shows that the ranking observed during validation is maintained when split into independent test sets. AgroNPK-GATE demonstrates the best overall performance, while regularized linear models remain highly competitive.
Figure 6.
Comparison of the proposed approach and comparison models on a test sample by macro_NRMSE.
The obtained values demonstrate that the proposed approach maintains a high level of generalization on the test set. Regularized linear models remain competitive in a reduced-input feature space. The highest errors are observed for CompactTabularMLP, MLPRegressor, and DummyMean, indicating that overly complex architectures do not offer an advantage when the predictive signal is limited. Additional results obtained from an external validation sample within AgroLens are presented in the Supplementary Materials (Figure S8). Because this sample was obtained from the same AgroLens source, the reported results should be interpreted as an assessment of robustness within the dataset rather than as an independent external validation.
Figure 7 presents the macro_MAE comparison on the second AgroLens holdout. AgroNPK-GATE again achieved the best overall accuracy, confirming that its advantage is preserved across different evaluation metrics.
Figure 7.
Comparison of models using the additional macro_MAE metric on the external-style holdout within AgroLens.
The obtained results show that AgroNPK-GATE maintains its advantage not only in normalized error but also in mean absolute error in the external-style holdout within AgroLens. Figure 8 presents the estimated coverage of the interval forecasts for the target variables N, P, and K in the validation, test, and external-style holdout within AgroLens. The dotted line corresponds to the nominal coverage level of 90%, and the horizontal bars represent the proportion of actual values falling within the calculated intervals. In the validation set, the coverage is almost identical to the specified level, amounting to 0.900 for N and P, and 0.899 for K. In the test set, the values are 0.922 for N, 0.904 for P, and 0.920 for K. In the external-style holdout within AgroLens, the coverage also remains close to the nominal level, amounting to 0.918 for N, 0.896 for P, and 0.921 for K.
Figure 8.
Comparison of the actual coverage of interval estimates for N, P and K.
Figure 9 presents the assessment of the quality of uncertainty using the average width of interval predictions for the target variables N, P, and K in the validation, test, and external-style holdout within AgroLens. The analysis was performed after calibrating the interval boundaries to determine the required range widths to achieve the specified level of coverage for each target variable. The interval widths remain the same across samples for each target: for N, the average width is 2.312, for P, 73.04, and for K, 444.8. This stability indicates that the interval boundaries were specified as target-wise calibrated values and then applied equally across different parts of the data, without additional adjustment in test or external-style holdout within AgroLens. The narrowest intervals are observed for N, which corresponds to a smaller physical scale and a more compact distribution of this variable. For P, the intervals are significantly wider, reflecting the greater spread of phosphorus values. The widest intervals are obtained for K, which is explained by the high variability of potassium and the presence of large extreme values in the target matrix. Thus, Figure 9 demonstrates that forecast uncertainty depends significantly on the scale and distribution of a specific macronutrient. This confirms the need to estimate N, P, and K not only based on point errors but also on the width of confidence intervals, since the same modeling procedure yields fundamentally different interval scales for different target variables.
Figure 9.
Estimating the width of interval forecasts for N, P, and K on different samples.
Figure 10 compares the computational latency, in milliseconds per observation, across three datasets: validation, test, and external-style holdout within AgroLens. This analysis was performed after the computations were completed to evaluate not only the forecasting quality but also the practical suitability of the computational pipeline in terms of the speed of processing individual records. For the validation set, the average latency is 0.097 ms/observation; for the test set, it is 0.109 ms/observation; and for external-style holdout within AgroLens, it is 0.071 ms/observation. All values are significantly below 1 ms per observation, indicating a very low computational cost for the inference. Small differences between the sets may be due to batch size, computational specifics, and environmental system fluctuations, rather than to a fundamental change in processing complexity. The highest latency is observed for the test set (0.109 ms/observation), but even this value remains practically insignificant for table inference. On external-style holdout within AgroLens, the latency is lower (0.071 ms/observation), which shows that there is no computational degradation when applying the procedure to the delayed part of the data.
Figure 10.
Comparison of inference latency on validation, test, and external-style holdout within AgroLens.
Figure 11 compares the models based on two criteria: the inference lag per observation and the external macro_NRMSE. The x-axis represents the computational lag, and the y-axis shows the normalized error on the external-style holdout within AgroLens. The optimal region is characterized by low error and minimal lag. Most models exhibit low computational lag, but reducing inference time does not always improve forecasting quality. Some models with higher lags also do not provide a significant improvement in external macro_NRMSE, indicating a lack of a direct relationship between computational complexity and accuracy. AgroNPK-GATE occupies a low external macro_NRMSE value and a moderate lag of approximately 0.07 ms per observation. This position characterizes the proposed approach as a balanced solution in terms of forecasting quality and computational efficiency.
Figure 11.
The ratio of computational efficiency and forecasting quality of models.
Figure 12 presents a direct comparison of AgroNPK-GATE with the best baseline model, Ridge, based on the macro_NRMSE metric. This analysis allows us to evaluate the contribution of the proposed hybrid architecture relative to the strong, regularized baseline solution. Ridge shows a macro_NRMSE value of 0.990, while AgroNPK-GATE achieves a value of 0.984. The difference between the models is 0.006 in favor of the proposed approach. This indicates a moderate but measurable reduction in the average normalized error for the target variables N, P, and K. This result confirms that the inclusion of hybrid residual correction improves forecasting quality relative to the robust linear baseline model under the specified reduced-input protocol.
Figure 12.
Comparison of the proposed approach with the best baseline model by macro_NRMSE.
Figure 13 presents a direct comparison between AgroNPK-GATE and the best SOTA-style model, ExtraTrees_Regularized, using the macro_NRMSE metric. This metric reflects the average normalized error across the target variables N, P, and K. ExtraTrees_Regularized shows a macro_NRMSE of 0.996, while AgroNPK-GATE achieves 0.984. The difference is 0.012 in favor of the proposed approach. This indicates a reduction in the total normalized error relative to the strong ensemble model, within the same reduced-input formulation and single-evaluation scheme. This result confirms that the proposed hybrid architecture provides a measurable advantage over the best SOTA-style model among the comparison algorithms.
Figure 13.
Comparison of the proposed approach with the best SOTA model by macro_NRMSE.
Figure 14 presents the results of the ablation analysis aimed at assessing the contribution of individual feature groups and components of the computational scheme to forecasting quality. The main metric is macro_NRMSE, where a lower value indicates a lower average normalized error across N, P, and K. The highest error is observed in the spectral_only variant, with a value of 1.006, indicating that the spectral channels alone are insufficient to form a stable forecast signal. Excluding temporal and crop-related features also leads to a deterioration in quality, as confirmed by values of 1.002 for the without_temporal_crop_context and without_crop_context variants. The without_residual_correction configuration shows a value of 0.985, while the full model reaches 0.984. This reflects the small contribution of residual correction to the final quality. The without_crop_interactions variant maintains a value close to the full model, indicating a limited effect of this group of interactions. The obtained results show that the forecasting quality is determined by the joint use of spectral, temporal, crop-related, and correction components, rather than a separate group of features.
Figure 14.
Ablative analysis of the influence of feature groups and architectural components on macro_NRMSE.
Figure 15 presents a summary assessment of the contribution of feature groups and model components based on the effect_on_primary_metric indicator. This indicator reflects the change in the primary metric when the corresponding component is excluded from the full configuration. The greatest impact is associated with the spectral_only option, with an indicator value of 0.022. This indicates that using only spectral features results in lower quality than the full model. A significant contribution is also made by the without_temporal_crop_context and without_crop_context options, which have a value of 0.018. This confirms the importance of temporal and crop-type features in stabilizing the predictive signal. The impact of the residual correction is limited to 0.001. Excluding crop-index interactions does not change the primary metric, which is reflected by the value of 0.000. Overall, the results show that the final quality is determined by the joint use of spectral, temporal, and crop-related features, while individual additional components provide a less pronounced contribution.
Figure 15.
Summary assessment of the contribution of components by impact on the main metric.
Figure 16 presents an analysis of forecast quality stability as the input feature space changes and distortions are added. The evaluation is performed using the macro_NRMSE metric, where lower values indicate lower normalized error. The baseline clean scenario has a value of 0.984 and is used as a control benchmark. When adding noise, the quality is almost preserved: for noise_2pct, the value is 0.984; for noise_5pct, the value is 0.985. The missing_10pct scenario increases the error to 0.997, indicating a higher model sensitivity to increased proportions of missing values. The most pronounced deterioration occurs when key groups of features are excluded. For no_vegetation_indices, the macro_NRMSE value is 0.999, for no_spectral_bands 1.002, and for no_crop_context 1.003. The obtained results show that the stability of the model largely depends on the preservation of spectral, index, and crop-related features.
Figure 16.
Analysis of the stability of quality when excluding groups of features and adding distortions.
Figure 17 presents a subgroup analysis of forecast error by crop type using the macro_NRMSE metric. The calculation was performed separately for each group, allowing us to identify differences in the quality of N, P, and K estimates across crop categories. The highest error is observed for oats, at 1.909. For common_wheat, the macro_NRMSE value is 0.954. Lower error values are obtained for sugar_beet 0.876, maize 0.835, barley 0.772, durum_wheat 0.721, and rye 0.717. The smallest error is recorded for sunflower with a value of 0.600. The results show that forecast quality varies significantly across crop types. This confirms the need to take into account the structure of the crop data when interpreting model errors and assessing its generalization ability.
Figure 17.
Subgroup analysis of error by crop type based on macro_NRMSE.
Figure 18 presents a statistical comparison of AgroNPK-GATE with the two strongest comparison models, Ridge and ExtraTrees_Regularized. The x-axis shows the difference in mean error between the proposed and comparator formats. Since the comparison is based on the error metric, negative values indicate an advantage for the proposed approach. For the pair AgroNPK-GATE and Ridge, the average difference is −0.006. For the pair AgroNPK-GATE and ExtraTrees_Regularized, the difference is −0.012. In both cases, the difference favors the proposed model, confirming its error reduction relative to the strong-regularized linear model and the ensemble benchmark. These results indicate that the advantage of AgroNPK-GATE is moderate but measurable within the chosen experimental protocol.
Figure 18.
Summary of statistical comparison of the proposed approach with the best comparison models.
Figure 19 shows the dynamics of the macro_NRMSE value across three evaluation stages: validation, test, and external-style holdout within AgroLens. The graph is constructed to examine how forecasting quality changes as we move from the sample used for configuration selection to independent lagged datasets in AgroLens. Since macro_NRMSE is an error metric, lower values correspond to more accurate forecasting. On the validation sample, the value is approximately 0.873, reflecting a better level of quality during the setup and configuration selection stage. On the test sample, the error increases to 0.968, and on the external-style holdout within AgroLens, to 0.984. This sequence demonstrates the expected decrease in quality when moving to more rigorous lagged data. However, the increase in error is not sharp: the test and external-style holdout within AgroLens values remain close to each other, indicating the absence of strong degradation between the two independent evaluation sets within a single benchmark.
Figure 19.
Stability of forecasting quality in validation, test, and external-style holdout within AgroLens using macro_NRMSE.
Importantly, the external-style holdout within AgroLens has the highest error value and should therefore be considered the most conservative quality assessment within this experimental design. The difference between the validation and external-style holdout within AgroLens results confirms that the validation result cannot be used as the sole basis for quality conclusions. Thus, Figure 19 demonstrates that the final assessment should be based on test and external-style results, rather than solely on the quality obtained during tuning.
Figure 20 presents the model explainability assessment by showing the contribution of coarse-grained feature groups to the macro_NRMSE. The x-axis reflects the average change in error when excluding or violating the corresponding feature group. A higher value indicates a greater contribution of the group to the predictive signal. The vegetation_water_indices group has the greatest impact with a value of 0.113. A similar contribution is demonstrated by spectral_bands, with a value of 0.102, confirming the key role of Sentinel-2’s spectral-index characteristics. The crop_context group has a moderate value of 0.034, while temporal_descriptors shows a small contribution of 0.007. The missingness_indicators group has no noticeable impact on the metric, as its value is 0.000. The obtained results show that the main explanatory power of the model is associated with vegetation indices, water indices, and Sentinel-2 spectral channels, while crop attributes and temporal characteristics perform an additional clarifying function.
Figure 20.
Interpretation of the contribution of feature groups by the change in macro_NRMSE.
Overall, the comparative experiment showed that AgroNPK-GATE consistently achieved the lowest error values within the adopted reduced-input protocol. Nevertheless, the observed improvement over strong linear and ensemble baselines was moderate. The main contribution of the framework, therefore, lies not in a large performance gain, but in providing a leakage-controlled, interpretable, and uncertainty-aware screening framework that maintains stable performance across validation and held-out partitions.
3.3. Model Interpretability, Uncertainty Analysis, and Screening-Oriented Evaluation
The analysis focuses on model interpretability, forecast uncertainty assessment, and validation of the proposed approach for screening-oriented preliminary soil macronutrient assessments. This stage uses SHAP-based explanation methods, residual-error distribution analysis, reliability assessment of interval forecasts, and evaluation of the quality of observation ranking under preliminary screening conditions. Particular attention is paid to which groups of features form the main forecast signal, the robustness of interval estimates, and the extent to which the model can be used for practical plot prioritization in digital farming systems. Figure 21 presents a SHAP beeswarm analysis for the target variable N, performed based on the proposed model. The graph depicts the contribution of individual features to the nitrogen content forecast and the direction of their influence on the model output. Positive SHAP values increase the N forecast, negative values decrease it, and the color of the dots reflects the value of the corresponding feature. The idx_NDVI feature has the greatest influence, indicating the importance of the surface vegetation state in nitrogen assessment. The spectral features band_B02_mean9, band_B12_mean9, band_B03_mean9, and band_B11_mean9 also make a significant contribution. Important factors include the index and ratio features ratio_RE3_RE1, idx_CIrededge, ratio_RE2_RE1, ratio_SWIR1_NIR, idx_NDMI, and idx_RECI, related to vegetation, moisture characteristics, and the red-edge range. Features related to crop types, including crop_rye, crop_sunflower, crop_maize, and crop_oats, contribute locally to the forecast. Overall, the SHAP analysis shows that the main explanatory power for N is formed by the spectral-index features of Sentinel-2.
Figure 21.
SHAP analysis of the influence of traits on the prediction of nitrogen content N.
Figure 22 presents the SHAP beeswarm analysis for the target variable P, performed based on the proposed model. The graph reflects the contribution of individual features to the phosphorus content prediction and the direction of their influence on the final value. Positive SHAP values increase the P prediction, negative values decrease it, and the color of the dots reflects the value of the corresponding feature. The most significant features are idx_NDRE, inter_EVI_NDMI, band_B03_mean9, crop_maize, inter_NDVI_NDMI, band_B02_mean9 and band_B12_mean9. This shows that the phosphorus prediction is formed by combining spectral channels, red-edge characteristics, and interactions between vegetation indices and moisture conditions. The crop_maize feature is also among the leading factors, indicating the contribution of crop type to the P estimate. The results of the SHAP analysis show that, for phosphorus, the main explanatory signals are associated with red-edge indices, spectral channels, index interactions, and crop features.
Figure 22.
SHAP analysis of the influence of traits on the prediction of phosphorus content P.
Figure 23 presents a SHAP beeswarm analysis for the target variable K, performed based on the proposed model. The graph reflects the contribution of features to the potassium content prediction and the direction of their influence on the final value. Positive SHAP values increase the K prediction, while negative values decrease it. The color of the dots reflects the magnitude of the corresponding feature. The most significant feature is the ratio_SWIR1_NIR, which indicates that the near-infrared-to-shortwave-infrared ratio is a key factor in potassium estimation. Idx_NDRE, idx_NDMI, inter_NDRE_NDMI, band_B12_mean9, band_B04_mean9, and idx_EVI also make significant contributions. These features are related to the red-edge band, moisture characteristics, SWIR channels, and overall vegetation activity. Traits related to crop types, including crop_durum_wheat, crop_rye, crop_sunflower, and crop_oats, are also significant factors, but their influence is local. The wider range of SHAP values for K reflects the high variability of this target variable compared to N and P.
Figure 23.
SHAP analysis of the influence of traits on the prediction of potassium content K.
Figure 24 presents a diagram of the interval calibration reliability, reflecting the correspondence between the nominal coverage level of 0.90 and the actual proportion of observations falling within the predicted intervals. The dashed diagonal line corresponds to an ideal calibration, in which the expected and observed coverages coincide. The points near the 0.90 level demonstrate the consistency of the interval procedure with the specified reliability level. Some points are located almost on the diagonal line, while individual values are located slightly above it, indicating a moderately conservative nature of the intervals. In this case, the actual coverage is not lower than the nominal level. The obtained results confirm the correctness of the calibration of the predicted intervals and show that the interval estimate provides a robust representation of the uncertainty in the preliminary screening of soil macronutrients.
Figure 24.
Interval calibration reliability diagram at 90% nominal coverage.
Figure 25 presents an assessment of the suitability of the proposed approach for preliminary screening and prioritization of observations. The analysis is based on the ranking quality of the top 20% of objects the system classifies as high-priority cases. The Precision@20% value is 0.422, reflecting the proportion of relevant observations among the top 20% of the ranked list. The Recall@20% value is 0.324 and reflects the proportion of all relevant cases covered by this priority group. The results demonstrate that the proposed scheme enables the concentration of relevant observations at the top of the ranked list and can be used to prioritize sites before subsequent inspections or laboratory testing. These metrics characterize the quality of screening ranking, rather than the accuracy of direct diagnosis.
Figure 25.
Screening decision matrix for Precision@20% and Recall@20%.
Figure 26 compares the average widths of the prediction intervals for the target variables N, P, and K. The analysis was performed to assess the uncertainty in interval predictions for each soil macronutrient. The Y-axis displays the average interval width, which characterizes the range of possible values of the target variable. The narrowest interval is observed for N, with a value of 2.312, indicating a more compact distribution of nitrogen values. For P, the average interval width is 73.04, reflecting its higher variability. The largest interval width is obtained for K and is 444.8, which is associated with a significant spread of potassium values and the presence of extreme observations. The results show that uncertainty levels vary significantly across the target variables and depend on the scale and variability of the corresponding macronutrients. For potassium, it is especially important to accompany point predictions with an interval estimate of the uncertainty.
Figure 26.
Quality of prediction intervals for target variables N, P and K.
Figure 27 presents the distribution of residual errors, calculated as the difference between actual and predicted values. This analysis allows us to assess the nature of the model errors, including their near-zero concentration, asymmetry, and rare large outliers. The majority of the residuals are near zero, indicating that most observations lack a significant systematic bias. However, the distribution exhibits lateral tails, particularly in the positive region, where individual errors can take large values. The results demonstrate that the model provides a manageable error level for the majority of observations; however, the presence of long tails confirms the heterogeneity of the problem and the need to supplement point forecasts with outlier analysis and interval uncertainty assessment.
Figure 27.
Distribution of residual forecast errors.
Overall, the analysis of the results showed that the proposed AgroNPK-GATE framework provides robust, reproducible preliminary predictions of soil macronutrients in a reduced-input feature space. The results confirm that the combination of leakage-controlled preprocessing, residual-aware hybrid modeling, target-wise calibration, and uncertainty estimation enables the formation of a physically consistent proxy-screening pipeline for digital farming applications. Despite a modest performance improvement over baseline models with strong regularization, the proposed architecture achieved a consistent error reduction across all estimation stages while maintaining interpretability, uncertainty calibration, and computational efficiency. These results demonstrate that the residual correction strategy provides a moderate but reproducible advantage under reduced input data. Table 4 summarizes the predictive performance of AgroNPK-GATE and competing baseline models across the validation and independent hold-out partitions.
Table 4.
Comparative predictive performance of AgroNPK-GATE and baseline models across validation and independent hold-out partitions.
The AgroNPK-GATE model achieved the lowest error values across the evaluated partitions. However, the differences relative to the strong Ridge and ExtraTrees_Regularized baselines remained modest. On the second held-out partition, macro_NRMSE improved from 0.9903 (Ridge) and 0.9956 (ExtraTrees_Regularized) to 0.9840, while macro_MAE decreased from approximately 42.5 to 42.1. These results indicate a consistent but relatively small improvement under the adopted reduced-input evaluation protocol.
Given the relatively small magnitude of the observed improvement, additional statistical significance analyses were conducted to confirm the interpretation of the results. A detailed comparison, based on paired bootstrap confidence intervals, Wilcoxon signed-rank tests, and paired t-tests, is provided in the Supplementary Materials (Table S7).
Table 5 shows the baseline random/prevalence rates, Precision@20%, Recall@20%, and the resulting enrichment coefficients for N, P, and K in the second retained partition of AgroLens.
Table 5.
Screening-oriented evaluation relative to the random/prevalence baseline.
Table 5 shows the practical utility of AgroNPK-GATE in a screening-oriented scenario. The precision at 20% (Precision@20%) is estimated relative to the baseline abundance rather than an arbitrary threshold. For nitrogen, the random baseline is 0.2519, while AgroNPK-GATE achieves a precision at 20% (Precision@20%) of 0.4296, corresponding to an enrichment factor of 1.71×. For phosphorus, the baseline is 0.2250, and the achieved precision at 20% (Precision@20%) is 0.4296, leading to a maximum enrichment of 1.91×. For potassium, the baseline is 0.2623, and the precision at 20% (Precision@20%) reaches 0.4222, corresponding to an enrichment of 1.61×. These results demonstrate that the proposed framework consistently concentrates more relevant nutrient-poor cases in the top 20% of ranked plots than would be expected by random selection. Therefore, although the regression accuracy remains moderate, the model demonstrates practical value as a pre-screening and prioritization tool for directing limited soil sampling and laboratory testing resources to fields with a higher probability of nutrient deficiency.
Additional details regarding feature inclusion, exclusion, and the rationale behind the final corrected_core feature configuration are provided in Supplementary Materials (Table S8). Additional analysis of the limited explanatory power and R2 values across evaluation partitions is provided in Supplementary Materials (Table S9). Thus, the results of the experimental study confirm that the proposed hybrid machine learning framework is capable of robustly predicting N, P, and K contents using a limited set of spectral, temporal, and agro-spatial features from AgroLens and Sentinel-2. A comparative study demonstrated the superiority of AgroNPK-GATE in the key macro_NRMSE and macro_MAE metrics compared to linear, ensemble, boosting, and neural network comparison models. Additionally, it was established that the proposed architecture maintains stability on external-style holdout within AgroLens, demonstrates correct interval calibration, and has a low computational cost for inference. The results confirm that predicting soil macronutrients should be considered a proxy-oriented screening problem rather than a direct replacement for laboratory analysis. The proposed approach can serve as a basis for building practically reproducible and interpretable preliminary agricultural monitoring systems for precision agriculture applications.
4. Discussion
Feature space analysis revealed that the relationships between Sentinel-2 observations and soil macronutrients are primarily indirect and mediated by vegetation and soil processes. Nitrogen is closely linked to chlorophyll synthesis, leaf development, photosynthetic activity, and biomass accumulation. Consequently, nitrogen availability can influence vegetation viability and spectral characteristics in the red edge and near-infrared, explaining the importance of NDVI, red edge indices, and SWIR-related variables identified by the model. The contribution of these features is consistent with the known role of nitrogen in regulating canopy development and plant productivity.
The relationship between phosphorus and remote sensing variables is more complex and indirect. Phosphorus plays a critical role in root development, energy transfer, and the early stages of plant growth; however, phosphorus deficiency is often less pronounced in canopy reflectance than nitrogen deficiency. This may explain the weaker and less consistent predictive signal observed for phosphorus. The importance of characteristics associated with maize and vegetation-water interactions suggests that phosphorus status may be reflected through crop-specific growth responses rather than through a direct spectral signature. Potassium is closely linked to plant water balance regulation, stomatal function, osmotic balance, and stress tolerance. Therefore, moisture-sensitive variables, including spectral information in the near-infrared (SWIR) and near-infrared (NIR) ranges and vegetation-water interaction indices, may reflect indirect manifestations of potassium availability through plant water balance and stress response mechanisms. Thus, the significant contribution of SWIR/NIR-related characteristics observed in the SHAP analysis is consistent with the physiological role of potassium in maintaining water-use efficiency and plant tolerance.
An important methodological aspect is the interpretation of characteristics associated with crop type. Crop type should not be considered a causal factor determining soil nutrient status, as nutrient availability itself can influence crop choice, productivity, and management practices. In the proposed model, the crop_type and derived crop context variables are used only as contextual proxies reflecting spatial, agronomic, and management-related heterogeneity in the AgroLens dataset. Their contribution should be interpreted as auxiliary information helping to characterize local agricultural conditions, rather than as direct diagnostic indicators of nitrogen, phosphorus, or potassium status. Consequently, the identified associations do not imply a causal relationship between crop type and soil nutrient concentrations.
Overall, the results show that Sentinel-2 does not provide direct measurements of N, P, and K concentrations in the soil. Instead, the model uses indirect relationships between soil nutrient availability, vegetation condition, canopy development, and moisture dynamics. Therefore, the identified contributions of the characteristics should be interpreted as indicators of statistical relationships and model behavior, rather than as evidence of direct cause-and-effect processes in the soil.
5. Conclusions
In this paper, we propose a leakage-controlled hybrid machine learning framework, AgroNPK-GATE, for preliminary screening of soil macronutrient (N, P, and K) content using Sentinel-2 and AgroLens data. Unlike approaches that rely on extensive external data sources and high-dimensional feature spaces, the study was conducted in a reduced-input setting, using a limited but reproducible set of spectral, index, temporal, and agro-spatial features. The primary focus was not on directly replacing laboratory analysis, but on assessing the feasibility of extracting a robust proxy signal for preliminary monitoring and prioritization of agricultural plot surveys.
The study implemented a full preprocessing pipeline, including auditing the AgroLens source dataset, leakage control, group-aware data partitioning, train-only winsorization, and the generation of a model-ready feature space. An exploratory analysis revealed that the target variables N, P, and K exhibit different scales, asymmetries, and variability, and that the relationships among them are predominantly weakly linear and moderately nonlinear. It was also established that a useful forecast signal is generated by combining Sentinel-2 spectral channels, vegetation-water indices, and agro-spatial features. A comparative experiment showed that the proposed approach achieved the lowest macro_NRMSE and macro_MAE values among the evaluated models. However, the improvement over baseline models based on the Ridge and ExtraTrees algorithms was relatively modest, indicating that a significant portion of the predictive signal is already captured by simpler models in the feature space with reduced input data.
Additionally, SHAP interpretation, robustness analysis, computational efficiency assessment, and interval forecast calibration were performed. The results confirmed that vegetation-water indices, Sentinel-2 spectral features, and individual crop-related interactions make the most significant contributions to forecasting. Interval estimation demonstrated stable coverage close to the nominal level, and computational latency remained low for all inference stages, confirming the practical suitability of the proposed pipeline for preliminary screening tasks. The proposed model should be used as a preliminary tool for screening and ranking proxy data, not as a replacement for laboratory soil analysis or field-level precision fertilization. The most appropriate use case is to identify priority agricultural fields for subsequent sampling, monitoring, and agronomic inspection over large spatial areas. Given the indirect nature of the signals obtained by the Sentinel-2 satellite and the moderate predictive performance observed in this study, the model should support decision-making and resource allocation, rather than providing precise nutrient application recommendations at the field level.
Despite the obtained results, the study has several limitations. The external-style estimation was performed within a single AgroLens dataset and does not constitute independent cross-dataset validation. Furthermore, the reduced-input formulation deliberately limited the use of additional weather, soil-climate, and spatial information sources. Therefore, the proposed approach should be considered a reproducible framework for preliminary soil nutrient screening, rather than a universal system for accurate chemical forecasting. Further research could focus on expanding cross-regional validation, integrating weather and geospatial data, using multi-temporal Sentinel-2 sequences, and developing uncertainty-aware and physically informed approaches for digital agriculture. Adapting the proposed framework for operational decision support systems and large-scale agricultural monitoring scenarios is also a promising direction.
Supplementary Materials
The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/technologies14070418/s1.
Author Contributions
Conceptualization, O.N. and G.A.; methodology, O.N. and D.K.; software, A.O. (Amir Orazbay) and Z.S.; validation, O.N., G.A. and A.Y.; formal analysis, A.O. (Ainur Orynbayeva) and G.Z.; investigation, O.N., D.K. and A.O. (Amir Orazbay); resources, Z.S. and A.K.; data curation, A.Y. and A.O. (Ainur Orynbayeva); writing—original draft preparation, O.N.; writing—review and editing, G.A., D.K. and A.O. (Amir Orazbay); visualization, G.Z.; supervision, G.A.; project administration, O.N.; funding acquisition, G.A. All authors have read and agreed to the published version of the manuscript.
Funding
This research has been/was/is funded by the Science Committee of the Ministry of Education and Science of the Republic of Kazakhstan (Grant No. AP32716097. Development of an artificial intelligence-based information system for the analysis and forecasting of soil degradation using climate-hydrological and spectral data).
Data Availability Statement
The dataset used in this study is publicly available on Zenodo: TimeSen2Crop, https://zenodo.org/records/15100427 (accessed on 15 February 2026).
Acknowledgments
The authors would like to express their sincere gratitude to Moldir Yessenova for her valuable advice and constructive comments that significantly improved the quality of this work.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| AI | Artificial Intelligence |
| ML | Machine Learning |
| XAI | Explainable Artificial Intelligence |
| SHAP | SHapley Additive exPlanations |
| N | Nitrogen |
| P | Phosphorus |
| K | Potassium |
| NRMSE | Normalized Root Mean Squared Error |
| MAE | Mean Absolute Error |
| SOTA | State-of-the-Art |
| NIR | Near-Infrared |
| SWIR | Short-Wave Infrared |
| NDVI | Normalized Difference Vegetation Index |
| EVI | Enhanced Vegetation Index |
| NDMI | Normalized Difference Moisture Index |
| NDRE | Normalized Difference Red Edge Index |
| MSAVI2 | Modified Soil-Adjusted Vegetation Index 2 |
| NBR | Normalized Burn Ratio |
| RECI | Red Edge Chlorophyll Index |
References
- Abdikerimova, G.; Khamitova, D.; Yussupova, G.; Akhmetova, Z.; Azhibekova, Z.; Yessenova, M.; Uzakkyzy, N.; Tynykulova, A.; Bayegizova, A. A hybrid spatio-temporal model for probabilistic mapping of soil salinity in arid regions. IEEE Access 2026, 14, 42465–42484. [Google Scholar] [CrossRef] [Scilit]
- Li, Q.; Hu, Z.; Guo, Y.; Geng, Y. Multispectral Remote Sensing Monitoring Methods for Soil Fertility Assessment and Spatiotemporal Variation Characteristics in Arid and Semi-Arid Mining Areas. Land 2025, 14, 1694. [Google Scholar] [CrossRef] [Scilit]
- Diaz-Gonzalez, F.A.; Vuelvas, J.; Correa, C.A.; Vallejo, V.E.; Patino, D. Machine learning and remote sensing techniques applied to estimate soil indicators–review. Ecol. Indic. 2022, 135, 108517. [Google Scholar] [CrossRef] [Scilit]
- Vatkar, S.; Kulkarni, S. Automatic prediction of soil moisture using efficient convolutional neural network from the synthetic-aperture radar data. Remote Sens. Earth Syst. Sci. 2025, 8, 656–672. [Google Scholar] [CrossRef] [Scilit]
- Zhang, D.; Chen, Y.; Ma, P.; Wang, S.; Yi, S.; Huang, Z.; Zhao, B. Research on a Prediction Model for Northern Cold Climate Millet Yield per Unit Area Based on IWOA-BP. Agronomy 2025, 15, 2557. [Google Scholar] [CrossRef] [Scilit]
- Zhang, J.; Ni, J.; Wang, F.; Huang, H.; Zhang, D. Soil Classification from Cone Penetration Test Profiles Based on XGBoost. Appl. Sci. 2025, 16, 280. [Google Scholar] [CrossRef] [Scilit]
- El Bouanani, N.; Laamrani, A.; Hajji, H.; Bourriz, M.; Bourzeix, F.; Ait Abdelali, H.; El-Battay, A.; Amazirh, A.; Chehbouni, A. Estimating soil attributes for yield gap reduction in Africa using hyperspectral remote sensing data with artificial intelligence methods: An extensive review and synthesis. Remote Sens. 2025, 17, 1597. [Google Scholar] [CrossRef] [Scilit]
- Gunasekaran, K.; A., K.; Sreevardhan, P. Real-time soil fertility analysis, crop prediction, and insights using machine learning and deep learning algorithms. Front. Soil Sci. 2025, 5, 1652058. [Google Scholar] [CrossRef] [Scilit]
- Abdikerimova, G.; Khamitova, D.; Kassymova, A.; Bissengaliyeva, A.; Nurova, G.; Aitimov, M.; Shynbergenov, Y.A.; Yessenova, M.; Bekbayeva, R. Development of a Model for Soil Salinity Segmentation Based on Remote Sensing Data and Climate Parameters. Algorithms 2025, 18, 285. [Google Scholar] [CrossRef] [Scilit]
- Tussupov, J.; Abdikerimova, G.; Ismailova, A.; Kassymova, A.; Beldeubayeva, Z.; Aitimov, M.; Makulov, K. Analyzing disease and pest dynamics in steppe crop using structured data. IEEE Access 2024, 12, 71323–71330. [Google Scholar] [CrossRef] [Scilit]
- Arystanov, A.; Sagin, J.; Karabkina, N.; Arystanova, R.; Yermekov, F.; Kabzhanova, G.; Bekseitova, R.; Aktymbayeva, A.; Kutymova, N. Automatic classification of agricultural crops using Sentinel-2 Data in the rainfed zone of Southern Kazakhstan. Agronomy 2025, 15, 2040. [Google Scholar] [CrossRef] [Scilit]
- Jarbais, G.; Harshavardhanan, P. Key Determinants of Soil Erosion: Insights Using Machine Learning Algorithm. In International Conference on Recent Trends in Machine Learning, IOT, Smart Cities & Applications; Springer: Singapore, 2025; pp. 77–86. [Google Scholar] [CrossRef] [Scilit]
- Cao, L.; Liu, B.; Wang, Z. A novel resilient agro-ecological system for sustainable urban-rural agricultural integration. Sustain. Cities Soc. 2025, 135, 106973. [Google Scholar] [CrossRef] [Scilit]
- Kammerlander, C.; Kolb, V.; Luegmair, M.; Scheermann, L.; Schmailzl, M.; Seufert, M.; Zhang, J.; Dalic, D.; Schön, T. Machine learning models for soil parameter prediction based on satellite, weather, clay and yield data. arXiv 2025, arXiv:2503.22276. [Google Scholar] [CrossRef] [Scilit]
- Hu, Z.; Gui, R.; Hu, J.; Fu, H.; Yuan, Y.; Jiang, K.; Liu, L. InSAR digital elevation model void-filling method based on incorporating elevation outlier detection. Remote Sens. 2024, 16, 1452. [Google Scholar] [CrossRef] [Scilit]
- Paul, A.; Machavaram, R.; Kumar, D.; Nagar, H. Smart solutions for capsicum Harvesting: Unleashing the power of YOLO for Detection, Segmentation, growth stage Classification, Counting, and real-time mobile identification. Comput. Electron. Agric. 2024, 219, 108832. [Google Scholar] [CrossRef] [Scilit]
- Jun, S.; Yoo, D.G.; Jung, D. Toward Transparent and Reproducible Machine Learning–Based Research in Urban Water Networks. J. Water Resour. Plan. Manag. 2025, 151, 06025001. [Google Scholar] [CrossRef] [Scilit]
- Li, N.; Xiang, D.; Sun, X.; Hu, C.; Su, Y. Multiscale adaptive PolSAR image superpixel generation based on local iterative clustering and polarimetric scattering features. ISPRS J. Photogramm. Remote Sens. 2025, 220, 307–322. [Google Scholar] [CrossRef] [Scilit]
- Kilgore, A.; Restrepo, C. Integrating hyperspectral imaging, plant functional diversity, and soil-lithology to uncover mountainscape disturbance dynamics induced by landsliding. Remote Sens. 2025, 17, 1806. [Google Scholar] [CrossRef] [Scilit]
- Pallerla, C.; Feng, Y.; Owens, C.M.; Bist, R.B.; Mahmoudi, S.; Sohrabipour, P.; Davar, A.; Wang, D. Neural network architecture search enabled wide-deep learning (NAS-WD) for spatially heterogenous property awared chicken woody breast classification and hardness regression. Artif. Intell. Agric. 2024, 14, 73–85. [Google Scholar] [CrossRef] [Scilit]
- Latha, P.; Kumaresan, P. Deep learning for soil nutrient prediction and strategic crop recommendations: An analytic perspective. Nat. Environ. Pollut. Technol. 2025, 24, B4205. [Google Scholar] [CrossRef] [Scilit]
- Gurubaran, K.; Poornesh, S.; Shwetha, L.S.; A.M.B., D.A.; Vidhya, N.; Ramesh, P.; Bhuvaneswari, P.T.V. Machine learning approach for soil nutrient prediction. In 2023 IEEE Silchar Subsection Conference (SILCON); IEEE: New York, NY, USA, 2023; pp. 1–6. [Google Scholar]
- Mahalakshmi, S.; Anand, A.J.; Partheeban, P. Soil and crop interaction analysis for yield prediction with satellite imagery and deep learning techniques for the coastal regions. J. Environ. Manag. 2025, 380, 125095. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Akanova, A.; Ospanova, N.; Muratova, G.; Sharipova, S.; Tokzhigitova, N.; Anarbekova, G. A Hybrid Algorithm Combining Wavelet Analysis and Deep Learning for Predicting Agroclimatic Pest Infestations. Algorithms 2026, 19, 242. [Google Scholar] [CrossRef] [Scilit]
- Sharipova, S.; Muratova, G.; Akanova, A.; Anarbekova, G.; Ospanova, N.; Bigaliyeva, A. Verification of an analytical system model for predicting dynamics of cereal pest populations. EUREKA Phys. Eng. 2025, 5, 181–189. [Google Scholar] [CrossRef] [Scilit]
- Anarbekova, G.A.; Akanova, A.S.; Ospanova, N.N.; Sharipova, S.Y.; Seksenbayev, E.T. Comparative analysis of the hybrid Mamba and Transformer models for intelligent pest prediction. In International Conference on Intelligent and Fuzzy Systems; Springer: Cham, Switzerland, 2025; pp. 191–198. [Google Scholar] [CrossRef] [Scilit]
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. |
© 2026 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.


























