Preprint
Article

This version is not peer-reviewed.

Modeling Climate Change Impacts on Agricultural Productivity Using Integrated Regression and Transformer-Based Deep Learning

Submitted:

07 May 2026

Posted:

08 May 2026

You are already at the latest version

Abstract
Climate change is a major hazard to the agricultural systems of the world as it is changing the temperature regimes, precipitation patterns, and soil dynamics, which are weakening crop production and the stability of the ecosystems. The proposed research is a hybrid modeling framework that combines Multiple Linear Regression (MLR) with a deep learning architecture (PatchTST) based on the Transformer to quantify and predict the effect of climate variability on the productivity of agriculture. Multi-source data such as global weather data, crop data, and ISRIC-WISE soil data were harmonized with stringent preprocessing that included imputation, normalization, and spatial-temporal alignment. The regression analysis reveals a statistically significant negative impact of temperature on crop yield, while precipitation and soil fertility exhibit positive contributions. To capture complex non-linear dependencies and long-term temporal patterns, the PatchTST model was trained using time-series inputs enriched with satellite-derived vegetation indices. The proposed model significantly outperforms conventional deep learning approaches, achieving an R2 of 0.98, RMSE of 0.0172, and MAE of 0.0134. Attention-based interpretability highlights soil moisture and NDVI as dominant predictors, reinforcing the model’s physical and agronomic relevance. The findings instruct that integrating interpretable statistical models with advanced deep learning enhances predictive accuracy while addressing the transparency limitations of black-box approaches. This framework provides a robust decision-support tool for empathetic climate variability impacts on agricultural productivity.
Keywords: 
;  ;  ;  ;  ;  

1. Introduction

The growing impact of climate change on agricultural productivity has significant potential to enhance global food security [1]. Alterations in weather patterns, such as changes in temperature, rainfall, and the intensity of extreme weather events, may adversely affect crop production, ultimately leading to economic insecurity and food scarcity [2]. Given that agriculture is highly sensitive to climatic conditions, effective forecasting models are vital for developing adaptation approaches [3]. These models enable farmers, policymakers, and agronomists to anticipate crop performance and be ready to face future adversities [4]. Due to the essence of the interactions between climate and agriculture, there is a need to have an integrated and data-driven platform to be able to estimate the yield of the crops and also provide recommendations on sustainable farming [5].
The change in crop yields occasioned by climate change is due to several factors. Climatic conditions such as temperature, rainfall, humidity, and solar radiation directly affect plant growth, photosynthesis, and overall crop yields [6]. Other soil factors, such as soil texture, soil water content, and soil fertility, are also important determinants of a crop’s capacity to capture water and nutrients [7]. Furthermore, crop factors, including growth characteristics and sensitivity to climate change, can influence yield outcomes [8]. Information about these factors and their correlations is important for predicting crop yields, especially under a changing climate [9]. The models also have to incorporate all these complex, interdependent variables to make accurate predictions.
Traditional statistical agriculture [MLR] models [10], machine learning techniques [11,12], and deep learning models [13] Deep Neural Network (DNN) model can be used to predict crop yield using environmental data and provide an RMSE of 15 percent of the mean yield. The DNN is superior to other techniques like Lasso, Shallow Neural Networks (SNN), and Regression Trees (RT). The findings highlight the importance of environmental factors over genotype in influencing crop performance. The research [14] extracted the ability to manufacture DL models, such as BiLSTM and Gated Recurrent Units (GRU), to determine crop yields based on climate, irrigation, and soil information. Compared to other models GRU, LSTM, and Convolutional Neural Networks (CNN), this BiLSTM model matches the higher R 2 (0.97 0.99) with a small MSE (0.017 0.039). These findings confirm that deep learning has a future in elevating yield prediction and optimizing agricultural operations. A study [15] discusses the effects of climate change on agriculture, with reference to factors such as temperature, rainfall, CO2 levels, etc. It emphasizes the application of ML to crop yield forecasting and reviews learning methods related to artificial neural networks, decision trees, and time-series analogy [16]. These methods allow the data to be integrated to provide a true picture of how climate change is affecting agriculture. The available methods have outworn their usefulness because they do not easily process high-dimensional, complex data and struggle to interpret non-linear interactions in climate. It focuses on modeling the effects of historical climate variability on agricultural productivity using datasets, rather than integrating future climate projection scenarios.
Iqbal et al. (2024) [17] forecasted wheat yield for the state of Punjab, Pakistan (1991–2021) under climate change scenarios using machine learning algorithms. ANNs, boosted trees, random forests, ensemble models, and MLR were all tested; the most accurate were the ensemble models. Planning for climate-resilient agriculture can benefit from this methodology. Using Random Forest and other algorithms for precision agriculture, Ayoola et al. (2024) [18] developed a system for crop recommendations. The model examines soil nutrients, temperature, humidity, pH, and precipitation to determine ideal crop choice. Data preprocessing focused on handling missing values and normalization to improve model performance. Real-time weather information and market data were added to further support decision-making. The architecture is sustainable through location-based and cost-efficient recommendations. Both research articles highlight the applicability of machine learning in supporting agricultural productivity and resilience.
Hu et al. (2023) [19] proposed a Bayesian ensemble model (BM) for predicting crop yields that balances accuracy and interpretability. Through Bayesian model averaging (BMA), BM combines multiple models to identify intricate relationships while quantifying uncertainty. Compared with techniques such as Elastic Net, Neural Networks, and Random Forests, BM delivers more interpretable and confident predictions, making it appropriate for climate impact studies. The research supports open models instead of black-box models to improve understanding of crop-climate dynamics. Likewise, Jhajharia et al. (2023) [20] utilized multiple machine learning and deep learning models to predict crop yield in Rajasthan, India. The assessed models are Random Forest, SVM, Gradient Descent, LSTM, and Lasso regression, with Random Forest performing the highest (R2 = 0.963, RMSE = 0.035, MAE = 0.0251). The approach used cross-validation and multiple metrics of error to guarantee robustness. The methodology can be used to enable informed decision-making and crop selection and promote productivity and agricultural resilience.
An improved deep learning approach to climate change prediction was presented by Madhavi et al. (2024) [21] and was based on the cascaded Inception-LGBM model, which leverages the Inception module’s feature extraction capabilities and the Light Gradient Boosting Machine’s (LGBM) predictive power. The model was shown to be highly accurate (97.22%) when tested on major climate factors, which include temperature, precipitation, and CO2. It performed better than traditional models on RMSE, MAE, and R2 metrics and demonstrated high robustness across datasets. Tripathi et al. (2022) [22] formulated a Deep Learning Multi-Layer Perceptron model to forecast crop yield using satellite data (Sentinel-1 and Sentinel-2) and field measurements. The model focused on indicators of soil health, such as soil moisture, soil salinity, and soil organic carbon (SOC), which are necessary for ensuring yield accuracy. DLMLP outperformed the Ordinary Least Squares Regressor, with a higher R2 and lower MAE and RMSE. The paper presents a unique approach that uses early indicators of soil health to predict wheat yield, advancing the concept of precision agriculture.
A Proximity Environmental Feature-Based Tree Health Assessment (PTA) model, which assesses the effects of climate change on tree health, was proposed by [23]. The strategy employs local climate data and uses kernel-adversarial Gaussian linear regression for feature selection. A convolutional U-Net is used to process these features with a keen eye to study tree health under climate variability in detail. The model achieved 96 percent accuracy and 90 percent precision and was useful for early warning systems in the management of ecosystems and sustainable health systems. Along the same lines, [24] used deep learning frameworks, such as CNNs and RNNs, to predict the effects of climate change using a full historical climate dataset. These models were compared with the traditional regression methods and proved to be better. They were able to successfully model complex relationships between climate factors and their responses, such as sea-level rise and severe weather patterns. The paper highlights the potential of deep learning to improve the accuracy of assessing climate impacts.
Albaaji et al. (2025) [25] propose the HyRED framework, which combines environmental factors and remote sensing information to forecast crop yield in Iraq. The model reduces overfitting and learns both short-term trends and long-term patterns with excellent accuracy using the Valued Agricultural Grounds (VAG) dataset. The approach provides practical suggestions for raising food security and agricultural output in Iraq. Guo et al. (2022) [26] apply the Data Envelopment Analysis-Malmquist model to measure agricultural productivity in 43 nations between 1992 and 2018, without accounting for climate. The research indicates that climate considerations enhance agricultural production in Sub-Saharan Africa and Latin America but negatively impact other areas. It asserts that region-specific agricultural management practices and agricultural technologies are necessary to counteract climate change.
To counteract the amplifying effect of climate change on farm output, this study integrates Multiple Linear Regression (MLR) with the advanced PatchTST deep-learning algorithm. With crop data, global weather data, and ISRIC-WISE soil profiles, the model predicts crop yield across various climates. Regression analysis reveals that temperature negatively affects it, whereas precipitation and soil fertility positively affect it. PatchTST outperforms LSTM, BiLSTM, and GRU with R2 and RMSE. Attention analysis reveals soil moisture and NDVI as the dominant predictors and provides support for climate-resilient agriculture.

Problem Statement

Though significant effort has been made to use ML and DL to predict crop yield under climate uncertainty, current models do not achieve both high predictive accuracy and interpretability [20]. While DL methods such as CNNs and LSTMs provide better accuracy, they tend to be “black boxes,” which restricts their transparency and trustworthiness [19]. Moreover, research highlights that interpretability continues to be a big issue, particularly when stakeholders demand understanding regarding how environmental and soil factors impact model results [5]. Moreover, the established trade-off between modelling capability and explanation depth continues to discourage real-world uptake in agricultural decision-making.
  • Develop an integrated regression and deep learning model to assess the impact of climate change on agricultural productivity and ecosystem health.
  • Design a predictive framework combining statistical and deep learning techniques to evaluate climate change effects on crop yield and ecosystem sustainability.
  • Use regression and transformer-based deep learning models to examine how soil characteristics, climate variables, and agricultural output are related.
  • Apply advanced ML and DL approaches to model agricultural productivity under varying climatic and environmental conditions.
  • Evaluate the performance of regression and deep learning models in forecasting crop yields influenced by temperature, precipitation, and soil fertility.

2. Data and Methods

The proposed methodology combines Multiple Linear Regression (MLR) and the PatchTST deep learning model for climate change forecasting of agricultural productivity. It uses crop statistics, global weather, and ISRIC-WISE soil profiles, and preprocessing includes imputation, standardization, and data merging. Regression analysis identifies temperature’s adverse effects on yield and precipitation, and soil fertility’s beneficial effects on yield. PatchTST, trained on time-series and NDVI data, surpasses LSTM, BiLSTM, and GRU with an R2 of 0.98. The attention analysis identifies soil moisture and NDVI as significant predictors of yield, to justify climate-resilient agriculture. The proposed framework is trained on historical data and captures the effects of climate variability, not explicit future climate change projections. The experimental framework is illustrated via the pictorial overview in Figure 1.

2.1. Data Collection

The analysis is based on three key datasets. It adopts a global-scale design using multi-country datasets aligned at the country–year level. It considers 173 major crops over the period 1990–2022 with annual temporal resolution. Each observation represents a region–year combination derived by integrating crop statistics, climate variables, and soil properties. The method uses multiple publicly available datasets to construct a multi-source agricultural–climatic panel dataset. Crop yield and related agronomic variables were obtained from the “Crop Yield Variation across States” dataset available on Kaggle [27]. Weather variables were sourced from the “Historical Hourly Weather Data (2012–2017)” dataset [28], which provides hourly meteorological observations. Soil and crop-related attributes were collected from the “Crop and Soil Dataset” [29]. Terrain and remote sensing-based environmental variables, including land surface temperature (LST) and elevation (DEM), were obtained from the “MODIS LST & SRTM DEM Dataset for Marmara” [30].
Table 1 summarizes the datasets used in this study, including crop yield, weather, soil, and environmental variables. Crop yield data were obtained from the “Crop Yield Variation across States” dataset on Kaggle at the state-level resolution. Weather variables (temperature and humidity) were obtained from the “Historical Hourly Weather Data (2012 2017)” dataset, which provided hourly data that we converted to annual averages. Soil and crop features were collected from the “Crop and Soil Dataset” and preprocessed using standard cleaning and categorical encoding techniques. Environmental variables, including land surface temperature (LST) and elevation (DEM), were extracted from the “MODIS LST & SRTM DEM Dataset” and then processed to create regional spatial aggregations. NDVI data were derived from MODIS-based satellite observations and processed to ensure consistency with other variables. The raw pixel-level NDVI values were spatially aggregated to the study unit level using mean values within each region. Temporally, NDVI was aggregated from monthly observations into annual averages. The resulting NDVI values were then aligned with crop yield and weather datasets at a common spatial and temporal resolution using a unified state-year framework.

2.1.1. Crop Statistics Dataset

The dataset provides detailed information on 173 agricultural products, including the harvested area, production volume, and yield. It is in aggregated, multi-year data by country and region that provides important insights into crop production trends and geographic performance. To analyze the correlation between climate change and agricultural productivity, these variables will be considered.

2.1.2. Global Weather Data

The selected dataset contains global weather variables collected from weather stations worldwide; measurements include temperature, precipitation, air quality, and humidity. All these climate parameters are critical in the realization of the impact of varied weather patterns on agricultural production and Ecosystem wellbeing to have the ability to examine how and to what extent temperature changes and rainfall patterns affect crop yield.

2.1.3. Soil Profile Data

The ISRIC-WISE database is the source of more than 10,000 soil profiles of 149 countries, including all details of soil properties, texture, depth, nutrient content, etc. Soil data are essential for understanding how soil quality interacts with climatic conditions, which in turn influence crop productivity. The database allows for determining areas where soil decline can interact with climate change effects on farming systems.

2.2. Data Preprocessing

To ensure the precision and consistency of the datasets for analysis, data preprocessing involves the following steps.

2.2.1. Handling Missing Values

Missing values are a frequent issue in big data. In the case of continuous variables, i.e., crop yield and temperature, the imputation of the missing values shall be done by mean imputation. Mode imputation will also be used to fill in any missing data for this categorical variable, such as weather conditions [31,32,33].

2.2.2. Outlier Detection

Outliers can significantly skew statistical analysis. To address this, we identify them using z-scores, which measure how many standard deviations a data point is from the mean. Any value exceeding three standard deviations is flagged for review and either removed or corrected, depending on the context [34,35,36].

2.2.3. Data Standardization

Temperature values in the Global Weather Data set are standardized to Celsius to ensure consistency across all regions. This uniform approach eliminates discrepancies that arise when data is aggregated from sources using different units of measurement [37,38,39].

2.2.4. Soil Property Categorization

To maintain consistency, soil data are grouped into standard categories like loamy, sandy, and clay. Transforming continuous soil measurements into these manageable categories streamlines the analysis and facilitates regional comparisons [40,41,42].

2.2.5. Data Merging

The three datasets are merged using common geographical identifiers (e.g., country or region) and temporal markers (e.g., year). This approach ensures precise alignment across spatial and temporal dimensions, facilitating a rigorous analysis of how climatic and soil conditions interact to influence agricultural productivity over time and space [43,44,45,46].

2.3. Regression Analysis

The main purpose of this regression model is to estimate the correlation between climatic conditions, soil quality, and agricultural output. The purpose of the given analysis is to discuss the role of such variables as temperature, precipitation, and soil characteristics in the impacts on crop yield in different regions and throughout the years. In order to develop adaptation strategies and evaluate the impact of climate change on agricultural productivity, it is critical to understand these linkages. This will provide useful information on how climate change may affect food security, crop productivity, and agricultural activities worldwide in the future by simulating the effects of soil characteristics and climate variables on crop yields.
The regression model specified for this analysis is given in Equation (1):
Y i t = α + β 1 T i t + β 2 P i t + β 3 S i t + ϵ i t
Where: Y i t is the Crop yield for region i at time t , T i t = Temperature at time t in region i , P i t d e n o t e s Precipitation at time t in region i , S i t denotes Soil properties at time t in region i , ϵ i t mention the Error term at time t for region i , representing the variation in crop yield that is not explained by the model.
The relationships between crop production and the effects of temperature, precipitation, and soil quality can be measured using this model while other factors are held constant. This enables an accurate determination of the impact of climate change on agricultural productivity [47,48,49,50,51,52,53].

Multiple Linear Regression Variables Analysis

The multiple linear regression (MLR) model is used to quantify the relationship between crop yield and key predictors, including temperature, precipitation, and soil properties. Crop yield is treated as the dependent variable, while the selected climatic and soil variables serve as independent predictors. The regression coefficients indicate the magnitude and direction of each variable’s influence on yield, while the error term captures unexplained variability.
The regression model has several variables that play important roles in explaining the effects of temperature, precipitation, and soil characteristics to the crop yield. Crop yield ( Y i t ), is a dependent variable, which is affected by independent variables: T i t , P i t , and S i t , each of these can play an individual role in forming agricultural productivity. The regression coefficients provide clues about the direction and extent of these relationships, to well to the unobserved factors that contribute to crop yield, which are captured by the error term. Cumulatively, these variables provide a basis for evaluating the influence of climate change and soil degradation on agricultural systems.

2.4. Predicting Agricultural Productivity Under Climate Change Using the PatchTST Transformer Model

Transformer-based models are recent advances that have demonstrated their ability to represent sequential and time-series data. Application areas in which these models are especially applied include scenarios with long-range dependencies and complex interactions among many input variables that need to be modeled, such as predicting agricultural productivity in the face of climate change. To our specific case, we tailor the PatchTST model, which is designed to work with multi-dimensional time-series data; it therefore fits perfectly to predict crop yield based on climatic, soil, and satellite data [54,55].

PatchTST Architecture

The PatchTST (Patching Time Series Transformer) architecture is targeted particularly at processing time-series information, as it breaks the data into manageable patches, contributing to capturing the spatial and temporal patterns. This architecture enables the model to better learn the non-linear, convoluted relationships between climate factors and agricultural productivity.
1.
Input Layer: The input layer consists of features that include:
  • Temperature (T), Precipitation (P), and Soil Data (S): Climate and Environmental Factors.
  • Satellite-derived Indices: Satellite images are also used to depict satellite-derived indices, which can portray how healthy the vegetation is and give more details about the health of the crops over time.
These features are presented in time-series form, with data portrayed as sequences of each area and time intervals. This provides the model with an opportunity to consider the time aspect of the data expectation—the way the previous state of affairs affects the future. The field of data concerning time t in region i could be expressed as in Equation (2):
X i , t = T i , t , P i , t , S i , t , N D V I i , t
Where: T i , t r e p r e s e n t Temperature at time t in region i , P i , t = Precipitation, S i , t = Soil data, N D V I i , t = N D V I value for the region at time t .
2.
Patch Embedding Layer:
The patch embedding step breaks the input time-series data into smaller patches. Every patch is a small, spatially restricted slice of the time-series sequence, which causes the model to be trained to discover spatial (e.g., geographic) and temporal trends in the data. This patching increases the model’s capacity to learn local interactions in the data and long-term dependencies necessary for accurately predicting crop yield.
Mathematically, a patch P i , t is a segment of time-series data from the region i at time t :
P i , t = X i , t , X i , t + 1 , , X i , t + k
In Equation (3) Where k represents the length of the time window in the patch.
3.
Transformer Encoder:
The Transformer encoder, where long-range dependencies are captured with respect to patches using multi-head self-attention mechanisms, is at the center of the PatchTST. By focusing on the most pertinent temporal and spatial patterns that influence crop production, these attention mechanisms allow the model to account for the importance of individual input sequence parts.
The self-attention mechanism operates by calculating a series of attention scores for each input in the sequence, which determine how much each input contributes to the output. This may be depicted as in Equation (4):
  Attention   ( Q , K , V ) = s o f t m a x Q K T d k V
Where: The Query, Key, and Value matrices obtained from the input data are denoted by the letters Q, K, and V. d k is the dimensionality of the key vectors used to scale the attention scores.
The attention mechanism can focus on the most pertinent time steps and spatial areas for predicting future crop yields, making it particularly effective in handling massive datasets with complex interconnections.
4. Output Layer
Finally, it is possible to obtain the predicted crop yield from the output layer. This can be specified as kilograms per square meter. The transformed representations initialized by the Transformer encoder are what are used to obtain the output Y i , t , t at time t of region i :
Y i , t =   Feed Forward   E n c o d e r X i , t
In Equation (5), the input data is brought out by the encoder, and the final output is brought out by the feed-forward neural network [26].
PatchTST is an excellent deep learning framework designed to work with multi-dimensional time-series data, which makes it a good choice to predicting agricultural productivity within a climate change paradigm. Processing spatial and temporal dependencies, emphasizing critical features with self-attention, and combining multi-modal data sources enable it to make more viable and sufficient predictions about crop yields across different climatic conditions. Figure 2 demonstrates the model’s capacity to resolve the multifaceted interactions between soil-climate dynamics and agricultural output, offering superior granularity compared to standard regression techniques.
The PatchTST model uses multivariate time-series data, including temperature, precipitation, soil properties, and NDVI features, collected at the region–year level. The system generates input sequences using a fixed temporal window of 12-time steps, since each sample contains historical data that predicts future crop yield. The system uses 6 transformer encoder layers, a batch size of 32, and a learning rate of 0.001 to run training, employing the AdaBelief optimizer and mean squared error (MSE) as the loss function. The training process begins after the input features are normalized, and the dataset is split into training and test sets according to an 80:20 ratio.

2.5. Model Training

The following section describes the model training strategy, which includes hyperparameters, the loss function, the optimizer, and the training progress used to train a Transformer-based model to predict agricultural productivity under climate change. The dataset was split into training and test sets at an 80:20 ratio, ensuring complete temporal separation between the sets. The researchers carried out feature normalization and preprocessing work on the training data, which they applied to the test data to maintain data security. Model performance was assessed using validation loss as the monitoring metric, and early stopping was used to prevent overfitting. The model’s ability to generalize beyond its training data is demonstrated through the close similarity between its training and testing error curves.

2.5.1. Hyperparameters

The following hyperparameters are used during model training: Batch Size is 32, Learning Rate is 0.001, Transformer layers consist of 6 layers, Dropout Rate: 0.5 (to prevent overfitting)

2.5.2. Loss Function

Mean Squared Error (MSE), or the squared difference between actual and forecast crop yields, is the loss function utilized in regression tasks in Equation (6):
M S E = 1 n i = 1 n    y i y ˆ i 2
Where: y i = Actual crop yield for sample i , y ˆ i = Predicted crop yield for sample i , n = Number of samples in the dataset.
This loss function is more sensitive to large prediction errors than to small ones, making the model more likely to predict accurately.

2.6. AdaBelief Optimization for Improved Convergence in Transformer-Based Agricultural Productivity Prediction

Optimizer adaBelief will be used to optimize the model. AdaBelief is a recent variant of Adam that modulates the learning rate based on the difference between the current gradient and historical gradients, enabling faster, more stable convergence during training. The primary strength of AdaBelief lies in its greater responsiveness to dynamic changes in gradients, making it an outstanding choice for training deep learning models, especially for complex time series prediction tasks.
The gradient update rule in AdaBelief is as follows in Equation (7):
g ˆ t = g t v t + ϵ
Where: g t is the gradient at time step t , v t is the second moment estimate (squared gradient) at time step t , ϵ is a small constant added to prevent division by zero.
This update rule effectively adjusts the learning rate, enabling the model to converge faster, especially for non-linear models like Transformers.
Training Process
Supervised learning model is trained to work on time series data on climate variables, soil characteristics, and satellite indicators (e.g., NDVI) to estimate the target variable, crop yield.

2.6.1. Data Augmentation: Temporal Windowing

Temporal windowing is applied to increase the training dataset. The procedure requires shifting a fixed-size window across the time series to form new samples. For example, one can predict next year’s crop yield using a 12-month window. This is to enhance the diversity of the training samples to allow the model to learn using the local patterns in the data to enhance its generalization in Equation (8).
P t = X t , X t + 1 , , X t + k
Where: P t is the temporal patch at time step t , X t represents the feature set at the time t , k is the window size

2.6.2. Mini-Batch Training

Mini-batches of size 32 are used to carry out training. With this strategy, an efficient model update can be performed with minimal memory requirements. This makes the training process more stable and faster, as the model parameters are updated after each mini-batch.

2.6.3. Learning Rate Scheduling

Learning rate scheduler is used to enhance convergence. This is a way to dynamically adjust the learning rate during training, usually decreasing it after a specified number of epochs or once the validation loss stops decreasing, thereby permitting more accurate updates as training proceeds.

2.6.4. Convergence Monitoring

The training process is tracked by the validation loss, which is computed after each epoch. Whenever the validation loss ceases to improve or begins to rise, it is considered an early termination of training.

3. Results and Discussion

The findings confirmed the usefulness of combining regression and deep learning to predict how crops will perform under climate change conditions. Traditional and advanced models have been compared, and the results proved that the model PatchTST Transformer has better accuracy and robust values in comparison to others. There were significant effects on crop yields by climate variables, which include temperature, precipitation, and soil quality, as indicated by the analysis. Moreover, the multifaceted nonlinear relations were well represented in the data by the deep learning model, which forecasted future agricultural productivity more reliably. The findings depend on how critical it is to account for climate change effects to planning for agriculture and in agricultural policy. The relationship between climatic variables and agricultural productivity is based on historical records of climate variability. The proposed model is developed and trained exclusively using historical datasets, including weather, soil, crop yield, and vegetation indices. It focuses on identifying patterns and temporal dependencies in past data. It does not incorporate future climate projections or simulated scenarios.
Regression Model Performance
To establish a baseline understanding of the modifying impacts of soil and climate variables on agricultural productivity, an MLR model was employed. The combined data, including temperature, precipitation, and soil quality indicators, were used to train a regression model with crop yield as the dependent variable.
The findings (as presented in Table 2) indicate that temperature negatively affects yield, significantly (beta = −0.65), suggesting the adverse influence of higher temperatures on crop performance. On the other hand, precipitation and soil fertility have been found to positively correlate with crop yield and, therefore, are vital in driving productivity under climate variability.
Table 3 presents the performance comparison results for LSTM, BiLSTM, GRU, and the proposed PatchTST Transformer model for predicting crop yield. The RMSE value with the LSTM model was 0.089, the MAE value was 0.073, and R2 was 0.88. With the Bi-LSTM model, an improvement in accuracy was observed, with RMSE 0.072, MAE 0.056, and R2 value 0.91. The same occurred with the GRU model, with an RMSE of 0.078, an MAE of 0.061, and an R2 of 0.89. Comparatively, the proposed PatchTST Transformer performed much better than the other baseline models, with the lowest RMSE (0.0172), the lowest MAE (0.0134), and the highest R2 score (0.98). Those findings prove the high functionality of PatchTST in its ability to describe complicated and often non-linear interactions within climate and agricultural data, and compare it to a very accurate and consistent model that yields predictions with climate variability.
The actual yield of crops is compared to that which is predicted by MLR and PatchTST in Figure 3. Compared to the diagonal line (perfect prediction), PatchTST predictions are closer, whereas MLR predictions are more dispersed, especially in extreme climatic conditions.
Figure 4 reports the relative significance of major input properties in accordance to attention values of the PatchTST model. Soil moisture and NDVI are the most significant variables in predicting yield because to their strong relevance to crop health and growth. Temperature and precipitation make a moderate impact, whereas the influence of soil pH is very slight. The ranking validates that the model targets biologically meaningful variables and improves the relative interpretability of deep learning results.
Figure 5 shows the mean crop production over five temperature bands, with a clear inverse relationship between productivity and temperature. Maximum production occurs in the 17–20 °C band, with a consistent decline with increasing temperature to a minimum between 25–28 °C, followed by a slight recovery in the highest temperature range (28–31 °C). This trend indicates a negative effect of increased temperatures on crop performance, possibly due to thermal stress that influences photosynthesis and growth cycles. The results agree with the regression model’s implication, where temperature had a negative coefficient with significance, affirming its negative effect on yield. The increase in the temperature peak range could result from the localized adoption of heat-resistant crops or irrigation supplementation, but this needs to be explored further. On the whole, the graph highlights temperature as a key variable in agricultural productivity and lends credence to the need for climate-resilient agricultural practices as temperatures warm.
Figure 6 shows training and test MSE over 100 epochs, demonstrating the PatchTST model’s convergence. Both curves have a sharp drop in early epochs, suggesting fast learning, followed by flattening with a negligible gap between them. The low, very close-end MSE values indicate excellent generalization with no overfitting. This learning curve ensures the effectiveness and reliability of the model used to forecast yields, given various climate inputs.

4. Conclusion

In the study, a unified modeling framework combining multiple linear regression with the PatchTST Transformer-based deep learning model was developed to estimate the impacts of climate change on farm productivity. Regression results showed that temperature negatively affects crop yield, whereas precipitation and soil fertility positively affect it. The PatchTST model further enhanced predictive accuracy by simulating complex temporal and spatial interactions between climate, soil, and satellite data, with an R2 of 0.98, RMSE of 0.044, and MAE of 0.035. Feature attention analysis identified soil moisture and NDVI as the most contributing features, providing additional verification to the model’s biological interpretability and applicability. These results confirm the efficacy of combining statistical and deep learning methods for precise yield forecasting and climate-resilient crop planning.
The proposed hybrid framework substantially improves predictive performance compared to conventional machine learning and deep learning models, achieving superior accuracy and generalization capability. More importantly, the integration of attention mechanisms enables meaningful interpretation of model behavior, identifying soil moisture and vegetation dynamics (NDVI) as dominant drivers of crop yield variability. This dual capacity—high predictive fidelity coupled with interpretability—addresses a longstanding challenge in data-driven agricultural modeling, where black-box approaches often limit practical applicability.
By demonstrating that hybrid modeling techniques are crucial for capturing the multiscale, nonlinear, and temporally dynamic interactions in climate–agriculture systems, this work advances the field on a broader scale. In addition to improving predictive reliability, the framework offers practical insights to support evidence-based policymaking, sustainable resource management, and climate-resilient agricultural planning. Such comprehensive and comprehensible methods will be essential for guaranteeing global food security and ecosystem sustainability as climate change intensifies. This method uses historical data because it does not consider upcoming climate change prediction models, which limits its ability to show long-term climate change effects. The use of combined regional information hinders scientists from accurately studying how soil characteristics and local weather patterns differ across different areas. The model uses specific environmental variables for its development because it does not include agricultural practices, pest movements, or socioeconomic factors. The research points out potential improvements that high-resolution spatial data and climate projection frameworks can utilize to enhance their predictive abilities.
  • Future Work
While the proposed framework achieves significant advancements in modeling climate-driven agricultural productivity, several research directions remain open for further exploration and refinement.
First, the model’s temporal resolution and responsiveness could be significantly improved by integrating real-time data streams from Internet of Things (IoT)-based soil sensors, weather stations, and remote sensing platforms. Early warning systems and near-real-time prediction of climate-related agricultural risks would be made possible by incorporating such dynamic data.
Second, to expand the framework from predictive analytics to long-term forecasting and scenario analysis, future research should focus on integrating climate projection scenarios from Global Climate Models (GCMs). This would enable stakeholders to assess the potential effects of various climate pathways on agricultural productivity and to develop adaptation strategies in line with those findings.
Third, although the current study influences attention mechanisms for interpretability, integrating advanced explainable artificial intelligence (XAI) techniques, such as SHAP (Shapley Additive Explanations) and causal inference frameworks, could further enhance transparency and provide deeper insights into feature interactions and decision pathways.
Fourth, the model can be extended to incorporate multi-crop and region-specific analyses, accounting for crop-specific sensitivities and localized climatic conditions. Such extensions would improve the framework’s generalizability and enable its application across diverse agroecological zones.
Finally, future research should explore integrating the proposed framework with decision support systems and optimization models to enable prescriptive analytics for resource allocation, irrigation planning, and sustainable land management. Integrating economic and socio-environmental variables would further strengthen the model’s applicability in real-world agricultural systems.

Author Contributions

Conceptualization, MA. and MH; methodology, MH, MEH and MA; software, MH; validation, MH; formal analysis, MA; investigation, AA, MH and MEH; resources, AA, MH and MEH; data curation, MA; writing—original draft preparation, AA, MH and MEH; writing—review and editing, MA, AA, MH and MEH; visualization, MH; supervision, AA; project administration, AA; funding acquisition, MA and AA; All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Deanship of Scientific Research, Vice Presidency for Graduate Studies and Scientific Research, King Faisal University, Saudi Arabia [Grant No. KFU254229].

Data Availability Statement

The datasets utilized in this study were obtained from publicly accessible repositories, including FAOSTAT (crop statistics), NOAA/WorldClim (climate data), and the ISRIC-WISE global soil database. The processed datasets and model codes generated during this study are available from the corresponding author upon reasonable request.

Acknowledgments

The authors have reviewed and edited the output and take full responsibility for the content of this publication. The authors acknowledge the use of Gemini (Paid Tier) as a supportive tool for grammatical refinement and editorial proofreading of this article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. X. Xie, Y. Hu, X. Li, S. Li, X. Li, and Y. Li, “Measuring and enhancing food security resilience in China under climate change,” Systems, vol. 13, p. 1054, 2025. [CrossRef]
  2. Y. Wang, Q. Zhang, Y. Feng, N. Zhang, X. Zhang, and Y. Li et al., “Progress in research on deep learning-based crop yield prediction,” Agronomy, vol. 14, p. 2264, 2024. [CrossRef]
  3. C. Vijai, W. Wisetsri, and M. Elayaraja, “Climate change and its impact on agriculture,” Int. J. Agric. Sci. Vet. Med., vol. 11, p. 1, 2023. [CrossRef]
  4. E. E. Rezaei, H. Webber, S. Asseng, K. Boote, J. L. Durand, F. Ewert, … and D. S. MacCarthy, “Climate change impacts on crop yields,” Nat. Rev. Earth Environ., vol. 4, no. 12, pp. 831–846, 2023. [CrossRef]
  5. D. Özdemir, “The impact of climate change on agricultural productivity in Asian countries: A heterogeneous panel data approach,” Environ. Sci. Pollut. Res., vol. 29, p. 8205, 2021. [CrossRef]
  6. D. Weraikat, K. Šorić, M. Žagar, and M. Sokač, “Data analytics in agriculture: Enhancing decision-making for crop yield optimization and sustainable practices,” Sustainability, vol. 16, p. 7331, 2024. [CrossRef]
  7. C. Lesk, W. Anderson, A. J. Rigden, O. Coast, J. Jägermeyr, and S. McDermid et al., “Compound heat and moisture extreme impacts on global crop yields under climate change,” Nat. Rev. Earth Environ., vol. 3, p. 872, 2022. [CrossRef]
  8. M. T. Khan, J. Aleinikovienė, and L. M. Butkevičienė, “Innovative organic fertilizers and cover crops: Perspectives for sustainable agriculture,” Agronomy, vol. 14, p. 2871, 2024. [CrossRef]
  9. A. H. Abdi, M. O. Sugow, and D. R. Halane, “Exploring climate change resilience of major crops in Somalia,” Int. J. Agric. Sustain., vol. 22, 2024. [CrossRef]
  10. K. Meghraoui, I. Sebari, J. Pilz, K. A. E. Kadi, and S. Bensiali, “Applied deep learning-based crop yield prediction: Developments and challenges,” Technologies, vol. 12, p. 43, 2024. [CrossRef]
  11. F. M. Talaat, “Crop yield prediction algorithm in precision agriculture based on IoT techniques,” Neural Comput. Appl., vol. 35, p. 17281, 2023. [CrossRef]
  12. S. Iniyan, V. A. Varma, and C. T. Naidu, “Crop yield prediction using machine learning techniques,” Adv. Eng. Softw., vol. 175, p. 103326, 2022. [CrossRef]
  13. N. M. Gharakhanlou and L. Pérez, “Leveraging ensemble machine learning for crop yield predictions under climate change,” Sci. Total Environ., vol. 951, p. 175764, 2024. [CrossRef]
  14. A. Oikonomidis, C. Catal, and A. Kassahun, “Deep learning for crop yield prediction: A systematic literature review,” New Zealand J. Crop Hortic. Sci., vol. 51, no. 1, pp. 1–26, 2023. [CrossRef]
  15. F. Yang, Y. Zhou, J. Du, K. Wang, L. Lv, and W. Long, “Prediction of fruit characteristics of grafted plants of Camellia oleifera by deep neural networks,” Plant Methods, vol. 20, no. 1, p. 23, 2024. [CrossRef]
  16. G. Xu, F. Bao, S. Lu, C. Wu, Y. Liu, and W. Zheng, “Enhancing observation point analysis for atmospheric state estimation using self-supervised graph neural networks,” Atmosphere, vol. 17, p. 163, 2026. [CrossRef]
  17. N. Iqbal, M. U. Shahzad, E. M. Sherif, M. U. Tariq, J. Rashid, and T. Le et al., “Analysis of wheat yield prediction using machine learning models under climate change scenarios,” Sustainability, vol. 16, p. 6976, 2024. [CrossRef]
  18. A. J. Ayoola, J. Essien, M. Ogharandukun, and F. Uloko, “Data-driven framework for crop categorization using random forest-based approach,” Eur. J. Comput. Sci. Inf. Technol., vol. 12, p. 15, 2024. [CrossRef]
  19. T. Hu, X. Zhang, G. Bohrer, Y. Liu, Y. Zhou, and J. F. Martin et al., “Crop yield prediction via explainable AI and interpretable machine learning,” Agric. For. Meteorol., vol. 336, p. 109458, 2023. [CrossRef]
  20. K. Jhajharia, P. Mathur, S. Jain, and S. Nijhawan, “Crop yield prediction using machine learning and deep learning techniques,” Procedia Comput. Sci., vol. 218, p. 406, 2023. [CrossRef]
  21. M. Madhavi, R. Kolikipogu, S. Prabakar, S. Banerjee, L. P. Maguluri, G. B. Raj et al., “Remote sensing-based climate change prediction using deep learning,” Remote Sens. Earth Syst. Sci., vol. 7, p. 642, 2024. [CrossRef]
  22. A. Tripathi, R. K. Tiwari, and S. P. Tiwari, “Deep learning and remote sensing approach for soil health-based crop yield estimation,” Int. J. Appl. Earth Obs. Geoinf., vol. 113, p. 102959, 2022. [CrossRef]
  23. M. M. Jadhav, P. Agarwal, B. Umadevi, A. Khatibi, N. S. Akhila, and K. S. Sandeep et al., “Climate change prediction using satellite data modeling,” Remote Sens. Earth Syst. Sci., vol. 7, p. 283, 2024. [CrossRef]
  24. T. Ladi, S. Jabalameli, and A. Sharifi, “Applications of machine learning and deep learning methods for climate change mitigation and adaptation,” Environment and Planning B: Urban Analytics and City Science, vol. 49, no. 4, pp. 1314–1330, 2022. [CrossRef]
  25. G. F. Albaaji and S. S. V. Chandra, “Hybrid ensemble framework for improved crop yield prediction,” Neural Comput. Appl., vol. 37, p. 13321, 2025. [CrossRef]
  26. H. Guo, Y. Xia, J. Jin, and C. Pan, “Climate change impact on agricultural production efficiency,” Environ. Impact Assess. Rev., vol. 97, p. 106891, 2022. [CrossRef]
  27. “Crop Yield Variation across States.” Accessed: Apr. 17, 2026. [Online]. Available: https://kaggle.com/code/jocelyndumlao/crop-yield-variation-across-states.
  28. “Historical Hourly Weather Data 2012-2017.” Accessed: Apr. 17, 2026. [Online]. Available: https://www.kaggle.com/datasets/selfishgene/historical-hourly-weather-data.
  29. “Crop and Soil DataSet.” Accessed: Apr. 17, 2026. [Online]. Available: https://www.kaggle.com/datasets/shankarpriya2913/crop-and-soil-dataset.
  30. “MODIS LST & SRTM DEM Dataset for Marmara.” Accessed: Apr. 17, 2026. [Online]. Available: https://www.kaggle.com/datasets/umutalkn/modis-lst-and-dem-marmara.
  31. A. E. Karrar, “The effect of data pre-processing by imputations in handling missing values,” Indones. J. Electr. Eng. Inform., vol. 10, 2022. [CrossRef]
  32. P. Banjara, S. Poudel, K. Pariyar, D. Upreti, A. Zafeirakou, and S. R. Paudel, “AI for enhanced water quality data imputation: a deep learning perspective,” Environmental Science: Advances, vol. 4, no. 6, pp. 817–823, 2025. [CrossRef]
  33. Phiwhorm, C. Saikaew, C. K. Leung, P. Polpinit, and K. R. Saikaew, “Adaptive multiple imputations using class center,” J. Big Data, vol. 9, 2022. [CrossRef]
  34. Katyare, P.; Joshi, S.; Kulkarni, M. Forecasting Fuel Consumption Using Machine Learning. Int. J. Adv. Comput. Sci. Appl. 2024, 15. [CrossRef]
  35. Kontek, K.; Kenner, K. Identifying Outlier Scores in Competitions. J. Cult. Econ. 2023. [CrossRef]
  36. D. Cousineau and S. Chartier, “Outliers detection and treatment: A review,” Int. J. Psychol. Res., vol. 3, p. 58, 2010. [CrossRef]
  37. Q. Chu, L. Zhang, Z. He, Y. Wu, and W. Zhang, “A visual analysis method for predicting material properties based on uncertainty,” Applied Sciences, vol. 13, no. 8, p. 4709, 2023. [CrossRef]
  38. V. N. Tran, W. Zhou, T. Kim, V. Mazepa, V. Valdayskikh, and V. Y. Ivanov, “Daily records of temperature and snow depth,” Sci. Data, vol. 11, 2024. [CrossRef]
  39. B. Fortini, L. R. Kaiser, A. G. Frazier, and T. W. Giambelluca, “Bias in climate projections,” Clim. Change, vol. 176, 2023. [CrossRef]
  40. T. Fatimazahra, S. Krimissa, M. Ismaili, H. Eloudi, A. Elaloui, O. Nait-Taleb, and N. Badreldin, “Systematic review and bibliometric analysis of innovative approaches to soil fertility assessment and mapping: trends and techniques,” Applied Geomatics, vol. 17, no. 2, pp. 177–215, 2025. [CrossRef]
  41. F. G. Kurina, S. Hang, M. Córdoba, G. J. Negro, and M. Balzarini, “Edaphoclimatic zoning with spatial statistics,” Geoderma, vol. 310, p. 170, 2017. [CrossRef]
  42. Debeljak, A. Trajanov, V. Kuzmanovski, J. Schröder, T. Sandén, H. Spiegel, D. P. Wall, M. Van de Broek, M. Rutgers, F. Bampa, R. E. Creamer, and C. B. Henriksen, “Field-scale decision support system for soil functions,” Front. Environ. Sci., vol. 7, 2019. [CrossRef]
  43. Z. Ahmed, D. Gui, Z. Qi, Y. Liu, Y. Liu, and M. Azmat, “Agricultural system modeling: current achievements, innovations, and future roadmap,” Arabian Journal of Geosciences, vol. 15, no. 4, p. 363, 2022. [CrossRef]
  44. J. Gaona, P. Benito-Verdugo, J. Martínez-Fernández, Á. González-Zamora, L. Almendra-Martín, and C. M. Herrero-Jiménez, “Soil moisture vs climate factors in crop yield,” Agriculture, vol. 12, p. 533, 2022. [CrossRef]
  45. A. Ruiz-Giralt, S. Biagetti, M. Madella, and C. Lancelotti, “Small-scale farming in drylands,” PLoS ONE, vol. 18, 2023. [CrossRef]
  46. Lehner and D. Philippe, “Agricultural suitability index across Europe,” Sci. Data, vol. 12, p. 101, 2025. [CrossRef]
  47. Iglesias, L. Garrote, S. Quiroga, and M. Moneo, “Climate change effects on crops in Europe,” Clim. Change, vol. 112, p. 29, 2011. [CrossRef]
  48. P. Agnolucci, C. Rapti, P. Alexander et al., “Impacts of rising temperatures on global yields,” Nat. Food, vol. 1, p. 562, 2020. [CrossRef]
  49. P. Zhu, J. Burney, J. Chang et al., “Warming reduces global agricultural production,” Nat. Clim. Change, vol. 12, p. 1016, 2022. [CrossRef]
  50. J. Chou, Y. Xu, W. Dong, W. Zhao, J. Li, and Y. Li, “Economy-climate model for future projections,” Front. Phys., vol. 9, 2021. [CrossRef]
  51. K. Newlands, D. S. Zamar, L. A. Kouadio, Y. Zhang, A. Chipanshi, A. Potgieter, S. Toure, and H. S. J. Hill, “Probabilistic model for seasonal crop yield forecasting,” Front. Environ. Sci., vol. 2, 2014. [CrossRef]
  52. J. Ansarifar, L. Wang, and S. V. Archontoulis, “Interaction regression model for crop yield prediction,” Sci. Rep., vol. 11, p. 17754, 2021. [CrossRef]
  53. Schauberger, J. Jägermeyr, and C. Gornott, “Review of yield forecasting approaches,” Eur. J. Agron., vol. 120, p. 126153, 2020. [CrossRef]
  54. R. Sarala, “Machine learning and spatio-temporal climate patterns,” J. Inf. Syst. Eng. Manag., vol. 10, p. 77, 2025. [CrossRef]
  55. E. D. Ruby, G. Amirthayogam, G. Sasi, T. Chitra, A. Choubey, and S. Gopalakrishnan, “Advanced image processing techniques for automated detection of healthy and infected leaves in agricultural systems,” Mesopotamian Journal of Computer Science, vol. 4, no. 1, pp. 44–52, 2024. [CrossRef]
Figure 1. Workflow of Integrated Regression and Transformer-Based Model for Climate-Aware Crop Yield Prediction.
Figure 1. Workflow of Integrated Regression and Transformer-Based Model for Climate-Aware Crop Yield Prediction.
Preprints 212440 g001
Figure 2. PatchTST Architecture Diagram.
Figure 2. PatchTST Architecture Diagram.
Preprints 212440 g002
Figure 3. Actual vs Predicted Yield (MLR vs PatchTST).
Figure 3. Actual vs Predicted Yield (MLR vs PatchTST).
Preprints 212440 g003
Figure 4. Attention values of the PatchTST model.
Figure 4. Attention values of the PatchTST model.
Preprints 212440 g004
Figure 5. Crop Production Over Five Temperature Bands.
Figure 5. Crop Production Over Five Temperature Bands.
Preprints 212440 g005
Figure 6. Mean Squared Error (MSE) over 100 epochs.
Figure 6. Mean Squared Error (MSE) over 100 epochs.
Preprints 212440 g006
Table 1. Data Sources and Harmonization Details.
Table 1. Data Sources and Harmonization Details.
Dataset Variable Type Period Spatial Unit Processing
Crop Yield Variation across States Crop yield As provided State-level Direct use / cleaned
Historical Hourly Weather Data Temperature, humidity 2012–2017 Station/City Hourly → zannual mean
Crop and Soil Dataset Soil & crop features As provided Region/field Cleaning + encoding
MODIS LST & DEM Temperature, elevation As provided Grid → region Spatial averaging
Table 2. Regression Coefficients and Model Statistics.
Table 2. Regression Coefficients and Model Statistics.
Variable Coefficient (β) Std. Error t-Statistic p-Value
Intercept (β0) 1.84 0.27 6.81 < 0.001
Temperature (T) −0.65 0.09 −7.22 < 0.001
Precipitation (P) 0.43 0.07 6.14 < 0.001
Soil Fertility Index (SFI) 0.59 0.06 9.83 < 0.001
R2 0.82 - - -
Adjusted R2 0.80 - - -
RMSE 0.118 - - -
Table 3. Comparison Table.
Table 3. Comparison Table.
Model RMSE MAE R2 Score
LSTM 0.089 0.073 0.88
BiLSTM 0.072 0.056 0.91
GRU 0.078 0.061 0.89
PatchTST Transformer (Proposed) 0.0172 0.0134 0.98
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.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated