Next Article in Journal
Water Quality Assessment of the Jerma River: Application of the Water Pollution Index (WPI) Within a Torrential Catchment
Previous Article in Journal
Binary Logistic Regression Outperforms Decision Tree Modeling for Event-Based Landslide Prediction: Application to Dynamic Hazard and Threshold Mapping in Central Italy
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Comparative Performance of LSTM, ANN, and GAM in Predicting Precipitation and Temperature Anomalies Under Accelerated Warming: Evidence from Thohoyandou, South Africa (1990–2025)

by
Mueletshedzi Mukhaninga
,
Caston Sigauke
* and
Thakhani Ravele
Department of Mathematical and Computational Sciences, University of Venda, Private Bag X5050, Thohoyandou 0950, South Africa
*
Author to whom correspondence should be addressed.
Earth 2026, 7(2), 57; https://doi.org/10.3390/earth7020057
Submission received: 7 February 2026 / Revised: 13 March 2026 / Accepted: 23 March 2026 / Published: 2 April 2026

Abstract

Accurate forecasting of local weather patterns is essential for climate resilience and sustainable planning. This study analysed 35 years (1990–2025) of hourly temperature and precipitation data from Thohoyandou, South Africa, to assess the impacts of climate change and improve anomaly prediction. Exploratory analysis and Bayesian Estimator of Abrupt change, Seasonal change, and Trend (BEAST) decomposition revealed accelerated warming trends of 0.025 °C per year in temperature anomalies, alongside highly irregular rainfall patterns characterised by extreme events rather than systematic changes. Three models, Artificial Neural Networks (ANN), Long Short-Term Memory (LSTM) networks, and a Generalised Additive Model (GAM), were evaluated for anomaly forecasting, with feature selection guided by LASSO regression. For temperature, the LSTM performed better than the ANN and GAM, with MSE = 0.458, MAE = 0.457, MBE = 0.087, and MASE = 0.510. For temperature anomalies, the LSTM model performed best, followed by the GAM and ANN models. For precipitation anomalies, the LSTM model also achieved the lowest prediction error, with MSE = 0.187, MAE = 0.111, MBE = −0.009, and MASE = 1.873; however, MASE values above 1 indicate that rainfall forecasting remains challenging. These results show the LSTM model’s ability to handle temperature anomalies and the difficulty of modelling rainfall. GAM performed less accurately but steadily in modelling precipitation.

1. Introduction

One of the most important challenges the world faces in the twenty-first century is climate change, which is having a profound effect on the environment and the socio-economic well-being of the world’s population. Human activities, such as burning fossil fuels, deforestation, and land use, have affected the energy balance of Earth’s atmosphere, leading to global warming and climate change [1,2]. This, in turn, has led to extreme temperatures and irregular precipitation patterns, with a profound impact on the environment’s sustainability [3].
Although global and regional climate assessments are imperative for giving us a glimpse of the climate, there are instances in which the local climate is not considered. This is particularly true for local climate behaviour, especially when the local population is affected by climate change. To illustrate, the local climate is imperative in regions where the local population is affected by climate change, especially in the implementation of agricultural and water resource activities. The impacts of climate change, in this case, are usually seen through increases in temperature and decreases in rainfall [4].
The South African region is highly susceptible to climate variability due to its diverse climatic conditions and socio-economic disparities. Although research has been conducted at different levels of analysis, various insights have emerged regarding general trends in climate variability. However, little emphasis has been placed on local-scale changes and short-term variability, which have important impacts on smaller towns/local areas [5]. Such variability may influence agricultural productivity, water availability, and the resilience of local infrastructure and livelihoods, particularly in areas that depend heavily on climate-sensitive resources. Thohoyandou is a local community situated in the Limpopo Province in South Africa. In the past few decades, this region has experienced changes in temperature and precipitation patterns, affecting local activities such as agriculture, water availability, and biodiversity [4]. In addition, various socio-economic changes, such as infrastructure development and water availability, have negatively impacted the adaptive potential of various communities in South Africa [6]. Despite its economic importance in this region of South Africa, local-scale investigations of temperature and precipitation patterns have not been well addressed in Thohoyandou.
Accurate prediction of local weather patterns poses substantial methodological problems. In fact, widely used statistical methods for time series prediction, like Autoregressive Integrated Moving Average (ARIMA), Seasonal ARIMA (SARIMA), and Generalised Autoregressive Conditional Heteroscedasticity (GARCH), are commonly used for weather forecasting because they are computationally efficient and easy to understand and interpret [7]. General Circulation Models (GCMs) are commonly employed in large-scale climate projections. However, the spatial resolution of GCMs is generally poor and does not allow for accurate representation of local-scale climates. This means that small-scale areas, such as towns/municipalities, can end up with climatic characteristics that differ entirely from those of the rest of the region [8,9].
However, these challenges have spurred growing interest in applying machine learning (ML) methods to climate-related forecasting problems. ML algorithms can learn nonlinear relationships and temporal dependencies from data without prior knowledge of the underlying problem dynamics, making them well-suited for short-term forecasting. In Africa, ML methods such as Random Forests, Support Vector Regression, and gradient boosting models have been applied to rainfall and temperature forecasting in several studies [10]. In East and West Africa, recurrent neural network models, such as Long Short-Term Memory (LSTM) networks, have been successfully used for daily and hourly climate forecasting, indicating their effectiveness in modelling temporal dependencies and nonlinear relationships in time-series data [11].
The power of Artificial Neural Networks (ANNs) and LSTM networks can be leveraged for short-term time series forecasting. Furthermore, the vanishing gradient problem is addressed in LSTM networks through memory gates, which help learn long-term temporal dependencies and autocorrelation patterns in time series data [12]. Also, the success of deep learning techniques in handling nonstationary time series data indicates that such data can be used for training the model. That relevant features can be learned internally without the need for manual detrending [13]. In fact, results from large-scale forecasting competitions, such as the M4 competition, also show the potential of neural network-based forecasting methods for handling level and seasonal patterns in data while retaining high forecast accuracy [14]. In fact, comparative studies of different forecasting methods also show the potential of deep learning-based methods in handling nonstationary time series data [15,16]. From the perspective of representation learning in time series data, higher layers of the network learn higher-level features, making it useful for short-term forecasting tasks [17].
Recent literature has also highlighted the importance of incorporating transparent statistical baselines in the evaluation of machine learning models. Generalised Additive Models (GAMs) offer a flexible yet transparent approach for modelling nonlinear relationships between variables by fitting smooth functions of the covariates. GAMs have been successfully employed in various climate-related studies, including temperature interpolation and drought index modelling in a nonstationary climate [18]. GAMs have been successfully employed in South Africa to model drought-related variables, such as the Standardised Precipitation Evaporation Index, at different timescales. This indicates the capability of GAMs in modelling hydrological extremes in semi-arid regions of South Africa. Incorporating a GAM baseline into the study will improve its methodological rigour and provide a transparent approach to interpreting results relative to more advanced machine learning models [19].
In Africa as a whole, deep learning techniques such as LSTM networks have been successfully employed for monthly and seasonal rainfall forecasting in various regions, including Ghana. Machine learning techniques have been employed for rainfall prediction in arid and semi-arid regions of South Africa [20].
The effects of climate change in Thohoyandou have been further complicated by strain on the country’s infrastructure, water, and food security, with the most vulnerable populations affected [6]. The rising temperatures have been attributed to increased heat stress and irrigation needs, with irregular rainfall patterns negatively affecting agricultural activities and water management [21,22]. Although GCMs successfully capture large-scale climate patterns, they are less effective at representing local-scale variability [2,9]. Machine learning combined with decomposition techniques, including the Bayesian Estimator of Abrupt change, Seasonal change, and Trend (BEAST), has been found useful for forecasting fine-scale climatic patterns, including changes in expected climatic patterns and long-term climatic trends.
This research will focus on the forecasting of short-term temperature and precipitation anomalies in Thohoyandou, South Africa. Hourly data collected for many decades will be used. Anomalies will indicate deviations from expected seasonal patterns. Long-term climatic trends and structural changes will also be analysed separately using the BEAST decomposition technique. For forecasting, Artificial Neural Networks and Long Short-Term Memory will be used. A Generalised Additive Model will be used as the statistical model.
The remainder of this paper is structured as follows. Section 2 introduces the models, Section 3 presents the empirical results, and Section 4 provides a detailed discussion of these findings. Finally, Section 5 offers concluding remarks.

2. Materials and Methods

2.1. Study Area

The specific area of interest is Thohoyandou, located in Thulamela Local Municipality, Limpopo Province, South Africa (see Figure 1). Thohoyandou is situated at 30.4663° E, 22.9749° S, with an altitude of 596 m above sea level. Thohoyandou covers 42 km2, or 4200 hectares, thus defining the physical boundaries of the specific area of interest. Thohoyandou has a subtropical climate with hot, humid summers and dry, warm winters, with large seasonal changes in temperature and rainfall [23].
Study area: The area was chosen due to its complex local weather patterns and its significance to climate variability in Northern South Africa. Thohoyandou is also a data-scarce area, making it an ideal place to test ML forecasting methods. Thohoyandou can also represent various small and medium-sized towns in the north of South Africa that experience subtropical climatic conditions and rainfall variability. Similar climatic conditions have been observed in various areas of Limpopo and southern Africa [24]. Although it is essential to note that the analysis was conducted at a single location, it is believed to offer valuable insights for towns with similar climatic and environmental conditions. Caution is required in using it for areas with significantly different climatic conditions and urban structures.

2.2. Data Source

The historical weather data used in this study, which include hourly temperature (2 m) and precipitation (snow and rain) records over 35 years (1 January 1990 to 16 March 2025), were obtained from the Open-Meteo Historical Weather API, available at https://open-meteo.com/en/docs/historical-weather-api (accessed on 5 February 2025). By default, the API provides data derived from the ERA5 reanalysis produced by ECMWF. ERA5 provides hourly data at approximately 0.25° (25 km) spatial resolution and covers the full study period, making it suitable for multi-decadal analysis. Using ERA5 ensures temporal consistency over the entire 35-year period and avoids bias in long-term climate trend analysis.
This dataset was selected because there are no freely available long-term and continuous weather station data for Thohoyandou. ERA5 is well-validated and has been widely used in climate studies. The dataset is suitable for local climate change studies, trend analysis, and the development of machine learning models due to its length, quality, and hourly resolution [25]. The dataset’s high resolution and uniformity also enable accurate analysis of temperature and precipitation anomalies in a data-poor environment such as Thohoyandou.
The dataset has 308,616 hourly records from 1 January 1990 to 16 March 2025. The dataset has 35 years of continuous data for Thohoyandou. After feature engineering, the dataset has 308,448 values; temperature and precipitation are the main variables in this research. In addition to the original variables, several feature engineering variables were created to enhance forecasting accuracy, including lagged temperature anomalies (1, 2, 3, and 168 h), lagged precipitation anomalies (1, 2, 3, and 24 h), calendar variables (Day, Month, Hour), and meteorological covariates such as humidity, dew point, cloud cover, wind speed, wind direction, and atmospheric pressure.
During the data preprocessing, accuracy and validity were ensured for all variables. The most difficult part of preprocessing was handling the large number of zeros in the precipitation data. The zeros represent dry days, which are common in a subtropical environment. In this research, zeros were retained because removing them would bias the data. There were no missing values in this data set.
The temperature values showed continuous variation without any issues with the zero point. To enhance the depiction of climate variability, the anomalies of temperature and precipitation were determined by subtracting the long-term mean of the series from the hourly measurements. Anomaly variables are used to detect abnormal conditions, such as heat waves and rainfall, and are centred variables that can be employed for trend analysis and prediction. The outliers were not removed since they are actual extreme events of high interest in climate research.

2.3. Machine Learning Models

Two machine learning models were used in this research: the Artificial Neural Network (ANN) and the Long Short-Term Memory (LSTM) network. The ANN model served as the baseline, while the LSTM model served as the main forecasting model due to its better capacity to handle temporal dependencies.

2.3.1. Artificial Neural Network (ANN)

The concept of an ANN was first proposed in 1943 by [26], who developed a mathematical model of the artificial neuron. In 1958, the perceptron, the first algorithmically trainable neural network for binary classification, was proposed by [27]. Although the perceptron was inefficient for nonlinear classification problems, it was not until 1986 that the backpropagation algorithm was proposed by David Rumelhart, Geoffrey Hinton, and Ronald Williams in [28]. This was a major milestone in the field of neural networks because the algorithm enabled the training of multilayer neural networks using gradient descent to adjust the network’s weights. The algorithm works by computing the gradient of the error function with respect to each network weight and propagating the error backwards from the output layer to the input layer. Today, ANN is used for complex tasks such as image classification, natural language processing, and time series prediction.
A simple neural network in Mathematics can be defined as follows:
y k = ϕ j = 1 p w k j x j + β k ,
v k = j = 1 p w k j x j ,
β k = θ k ,
y k = ϕ ( μ k θ k ) ,
y k = ϕ j = 1 p w k j x j + β k ,
where Equation (2) defines v k as the input to the k th neuron, w k j as the weight linking input j to neuron k, and x j as the input feature. Equation (3) represents the threshold, denoted by θ . Figure 2 illustrates a multilayer feedforward ANN, comprising an input layer, hidden layers, and an output layer. This type of network contains three essential layers: an input layer, plus one or more hidden layers, and an output layer. Finally, Equation (4) includes ϕ , the activation function, which can be selected from various nonlinear functions such as the sigmoid function, ReLU, tanh, or others.

2.3.2. Long Short-Term Memory Network

Long Short-Term Memory (LSTM) networks are a class of recurrent neural networks used to learn long-term dependencies in sequential data streams. Figure 3 shows he structure of LSTM [30]. Unlike RNNs, LSTM networks use memory cells to store information over time. Three gates control these memory cells: the input gate, the forget gate, and the output gate. These three gates help control the flow of necessary information in the network, thereby eliminating the vanishing gradient problem in RNNs [31]. Due to LSTM networks’ ability to capture the nonlinear relationships in time series data, these models have been used in various applications, including weather forecasting and climatic analysis.

2.4. Generalised Additive Model (GAM)

A Generalised Additive Model, or GAM, is a highly flexible statistical model that allows predictor variables to take a nonlinear form with respect to the response variable. A Generalised Additive Model can thus be defined as:
h ( Y i ) = α + k = 1 K s k ( Z i k ) + ε i
where Y i is a response variable corresponding to a i t h data point in a dataset, α is an intercept term in a model, and ε i is a random error term in a model. From a different perspective, that is, from a link function perspective, a Generalised Additive Model can thus be defined as:
h ( E [ Y i ] ) = Z i β + k = 1 K s k ( Z i k )
where h ( E [ Y i ] ) is a link function, Z i is a vector of linear predictor variables corresponding to the i-th data point, and β is a vector of coefficients corresponding to each predictor variable [19].

2.5. Variable Selection

The Least Absolute Shrinkage and Selection Operator (LASSO) regression identifies the variables and coefficients that minimise prediction errors [32]. The popularity of Lasso regression lies in its ability to minimise the L1 norm of the regression coefficient vector and set its coefficients to zero. Lasso regression is particularly useful for solving problems involving high-dimensional data with many predictor variables. Lasso regression sets the coefficients of irrelevant variables to zero, thereby enabling variable selection [33]. Lasso regression helps identify key principal components during regression model fitting, and not the original features. Lasso regression can be described at its most basic level as shown in [33].
Y t = γ + b = 1 k β t x b t + e t ,   t = 1 , , n ,
where y is a response variable, and y 1 , , y n are measurements on the response variable, x b t , t = 1 , , n ; b = 1 , , k , are the values that correspond to their respective k predictors, γ , β 1 , , β k are parameters, and e t denotes the error term.

2.6. Grid Search Optimisation

It is a common practice when developing a solution that is based on machine learning to test and implement the best-performing model for a specific problem or task from the range of available models. In this research, the machine learning model is defined as the combination of an algorithm and adjustable parameters. The process of determining the optimal parameters for a specific problem or task is referred to as hyperparameter optimisation [34].
Hyperparameter tuning is an essential part of the overall process, as it significantly affects the model’s performance. Grid search is one of the most common methods for hyperparameter tuning. In this method, hyperparameter combinations are used to train the model fully, and the best-performing model is selected as the optimal one. The exhaustive search in the grid search method used for hyperparameter tuning ensures the model’s reliability [35]. The grid search method has been selected over random and Bayesian search methods for hyperparameter tuning. Grid search has been chosen for hyperparameter tuning because it ensures an exhaustive search over all possible hyperparameter values. Grid search has been used to hyperparameter-tune the ANN and LSTM models in this paper to achieve optimal prediction performance.

2.7. Measures of Forecast Accuracy

Mean Absolute Error
MAE = 1 n t = 1 n y t y ^ t ,
Root Mean Square Error
RMSE = 1 n t = 1 n y t y ^ t 2 ,
Mean Bias Error
MBE = 1 n t = 1 n y t y ^ t ,
Mean Absolute Scaled Error
MASE = 1 n t = 1 n y t y ^ t 1 n 1 t = 2 n y t y t 1 ,
In Equations (9)–(12), n denotes the total number of observations and t represents the time index ( t = 1 , 2 , , n ). The term y t denotes the actual observed value at time t, y ^ t represents the forecasted value at time t, and y t 1 denotes the observed value at time t 1 , which is used in the naïve baseline for the MASE calculation.

2.8. Diebold–Mariano Test

In addition to standard evaluation metrics, it is important to assess whether differences in forecast accuracy between competing models are statistically significant. To this end, the Diebold–Mariano (DM) test [36] was employed to compare the predictive performance of the ANN and LSTM models for temperature and precipitation anomalies.
Let y t denote the observed anomaly (temperature or precipitation) at time t, and let y ^ i t represent the corresponding forecast from model i  ( i = 1 , 2 ) . The forecast error for model i at time t is defined as
e i t = y t y ^ i t .
To reflect the practical importance of accurately capturing extreme anomalies, an asymmetric loss function was adopted in which underprediction errors are penalised more heavily than overprediction errors. This is because underestimating extreme positive or negative events may lead to insufficient preparation for heatwaves, unseasonal cold spells, or heavy precipitation. At the same time, slight overpredictions are generally associated with less severe consequences [18]. The loss function is specified as
g ( e i t ) = e i t + λ   1 ( e i t < 0 ) ,
where λ > 0 is the penalty parameter and 1 ( · ) is the indicator function.
The difference in the loss function values for the two competing forecasts is expressed as
d t = g ( e 1 t ) g ( e 2 t ) ,
which represents the relative loss difference between the two models at time t.
The null and alternative hypotheses for the DM test are stated as
H 0 : E [ d t ] = 0   ( equal   predictive   accuracy ) ,
H 1 : E [ d t ] 0   ( unequal   predictive   accuracy ) .
The value of the penalty parameter λ was chosen to introduce a moderate additional loss on underprediction errors without significantly affecting the loss distribution. Sensitivity analysis showed that the results of the DM test were insensitive to variations in λ within a reasonable range. The DM test thus provides a rigorous statistical methodology for assessing the significance of differences in forecast accuracy between the ANN and LSTM models, in addition to conventional error-based performance measures.

2.9. Software Tools and Libraries

All analyses were performed using Python 3.12, which supports data preprocessing, machine learning modelling, and visualisation. The main Python packages used were pandas for data manipulation, NumPy (version 2.4.3) for numerical computations, Matplotlib (version 3.10.8.) and Seaborn (version 0.13.2) for visualisation, and TensorFlow (version 2.20.0) for implementing neural network architectures. The R programming language (version 4.3.1) was used for the BEAST time-series decomposition of the climatic variables. The programming languages Python and R enabled the development of an efficient computational process.

3. Results

3.1. Data Overview and Statistical Properties

In this section, an in-depth analysis of the statistical characteristics of the 35-year hourly temperature and precipitation data shall be presented and analysed in relation to the data used in Thohoyandou. This section also aims to identify the data characteristics and assess the distributions of the variables.
As shown in Table 1, the temperature range was 4.4 °C to 41.3 °C, with an average of 20.15 °C and a standard deviation of 5.38 °C. The near-zero skewness of 0.179 and the negative kurtosis of −0.240 indicate that the temperature data are normally distributed, though slightly platykurtic. Such features are characteristic of Thohoyandou, which is located in a subtropical region with warm weather and moderate seasonal variations. The calculated temperature anomalies are properly normalised, with an average of zero and a moderate skewness of 0.517, indicating a greater frequency of warm anomalies.
On the other hand, precipitation has a highly skewed, leptokurtic distribution. Most hours have zero rainfall, and only a few instances contribute to the total rainfall volume. The mean precipitation is 0.12 mm, but the maximum is 18.6 mm, confirming that rainfall is intermittent in this region. The extremely high values of skewness (10.804) and kurtosis (186.258) for precipitation confirm that there are mostly dry hours interspersed with heavy rainfall, a characteristic feature of subtropical summers. The precipitation anomaly distribution shows similar characteristics, i.e., it remains skewed, confirming that standardising the anomaly values has retained the natural variability of rainfall.
To further evaluate the temporal characteristics of the data set, the Augmented Dickey–Fuller and the Kwiatkowski–Phillips–Schmidt–Shin tests were applied to the temperature and precipitation anomaly data. The former is a statistical test that assesses the stationarity of a data set, i.e., whether it exhibits a nonstationary trend. The KPSS test is similar, though it tests for the presence of a nonstationary trend.
As shown in Table 2, the ADF test rejects the null hypothesis of a unit root for the temperature and precipitation anomalies at the 5% level of significance. This confirms the data’s stationarity. The KPSS test, however, rejects the null hypothesis of level stationarity for the data. This implies the existence of deterministic trends. The above tests therefore jointly confirm that the data are trend-stationary, a property in which short-term variations are constant around a mean level, with a long-term trend. This trend-stationarity property can therefore be interpreted as the gradual climatic changes experienced in Thohoyandou over the 35 years. The anomaly data are therefore appropriate for modelling and forecasting, as they have the required temporal dependencies and meet the requirements of statistical and machine learning algorithms.

3.2. Exploratory Analysis of Temperature and Precipitation

The relationship between hourly temperature and precipitation over the 35 years is presented in Figure 4. The plot shows the density of observations, where darker colours represent a higher concentration of data points within each bin. Most observations are concentrated around zero precipitation, confirming the dominance of dry hours in the dataset. Temperature spans the full observed range regardless of precipitation levels, and no clear relationship between the two variables is evident, suggesting that short-term precipitation events occur largely independently of temperature variations. A few bins indicate relatively high precipitation values, representing rare but intense rainfall events associated with strong storm activity.
Temporal dynamics of the entire time series are shown in Figure 5. Temperature shows strong seasonality and annual cycles, suggesting climatological predictability, while precipitation is highly irregular, with sporadic bursts of rainfall. Daily cycles of temperature, such as diurnal cycles of heating and cooling, are also evident in the time series, though not depicted here. This shows that temperature is deterministic and predictable, while precipitation is stochastic.
The density and Q-Q plots for temperature and precipitation are shown in Figure 6, which illustrate differences in distribution. Temperature data have a normal distribution around 20–25 °C, while precipitation data have a highly skewed distribution with many zeros and extreme values. Seasonal variation in temperature data is evident. Summer months have higher temperatures, while winter months have lower temperatures. The months between these two seasons have a wider range of values. Precipitation data do not show a clear pattern across months. There are many zeros in precipitation data, along with some extreme values for rain hours.
The anomalies in temperature and precipitation relative to the 35-year mean are shown in Figure 7. In terms of temperature anomalies, there have been frequent positive deviations in recent years, indicating a gradual warming trend. In precipitation anomalies, there are frequent extreme values, showing no trend. These plots again highlight that temperature changes are progressive and predictable, but precipitation changes are highly variable and unpredictable.

3.3. BEAST Decomposition and Change Point Detection

To examine long-term climate changes in Thohoyandou, the Bayesian Estimator of Abrupt Change, Seasonal Change, and Trend (BEAST) was applied to temperature and precipitation anomalies. BEAST decomposes time series into trend, seasonal, and residual components while detecting abrupt change points using Bayesian model averaging, which accounts for model uncertainty [37]. Figure 8 presents the BEAST decomposition with panel (a) showing temperature anomalies and panel (b) showing precipitation anomalies. Each panel displays the original anomaly data over time alongside the decomposed components, including trend, seasonality, and identified abrupt change points, allowing for a comparative analysis of how temperature and precipitation patterns have evolved over the 35 years, highlighting significant shifts and underlying dynamics in each variable.
Table 3 summarises the detected trends and change points. Temperature anomalies increase by 0.0250 ± 0.0010 °C per year, with change points detected between 1992 and 2020, indicating accelerated warming beyond normal seasonal variability. Precipitation anomalies show a small upward trend of 0.0037 mm per year, with change points between 1991 and 2024, reflecting occasional abrupt shifts in rainfall patterns.
These results suggest that the temperature in Thohoyandou is rising steadily, with noticeable periods of abrupt warming likely linked to climatic events such as El Niño or anthropogenic influences. Precipitation remains irregular, with sudden changes, which emphasises the difficulty of accurately predicting rainfall patterns. In conclusion, it is important to monitor the changes for climate adaptation strategies.

3.4. Correlation Analysis

Figure 9 shows that the correlation analysis reveals that temperature anomalies are strongly related to temperature ( r = 0.86 ) and negatively correlated with relative humidity ( r = 0.78 ), with a moderate positive correlation with dew point. The anomalies have a strong correlation with precipitation data ( r = 0.98 ), but their correlation with other meteorological data is very weak. The calendar variables (day, month, hour) have minimal correlation with the anomalies. The variability of temperature is systematic and depends on many factors, whereas that of precipitation remains stochastic. These findings support the use of lagged temperature and precipitation anomalies as primary predictors for subsequent feature engineering and LASSO model selection.

3.5. Feature Engineering and Variable Selection

To capture temporal dependencies, lagged features were created: temperature anomaly (lags 1, 2, 3, 168 h) and precipitation anomaly (lags 1, 2, 3, 24 h). Calendar variables and other meteorological covariates (humidity, dew point, cloud cover, wind speed/direction, pressure) were also included.
LASSO regression with five-fold cross-validation selected predictors with non-zero coefficients, where the regularisation parameter λ was chosen to minimise the mean cross-validated prediction error. Figure 10 and Figure 11 show the results. Temperature anomaly is strongly influenced by lag1, dew point, and lag168, while precipitation anomaly is dominated by lag1, with minor contributions from lag3 and lag24. Calendar and other meteorological variables contribute minimally. This procedure ensures robust feature selection while avoiding overfitting.

3.6. The Models

The dataset was split into 90% for training and 10% for testing. This split was selected to ensure that the models had sufficient historical data to learn the temporal dependencies present in the long hourly time series. Alternative splits, including 70–30% and 80–20%, could also be considered to evaluate the robustness of the modelling framework. These alternative configurations may produce similar patterns in model performance, although the 90–10% split was selected because it provides sufficient data for model training while retaining an independent testing set. Prior to model training, predictor variables were normalised, and LASSO regression was used to select the most significant variables. Hyperparameter tuning was performed using grid search with early stopping to achieve optimal performance while minimising overfitting. Finally, the predictive capability of the models was evaluated on the test dataset to assess their ability to capture temporal dynamics in temperature and precipitation anomalies.

3.6.1. Model Hyperparameter Selection

The optimal hyperparameters for the ANN and LSTM models are presented in Table 4. These parameters were obtained using grid search combined with early stopping to prevent overfitting. The grid search explored the following ranges: hidden units 32, 64, dropout rate 0.2, 0.3, batch size 32, 64, learning rate 0.001, 0.0005, and the maximum number of epochs 20, 50.
The ANN architecture consisted of two dense hidden layers with ReLU activation functions, followed by dropout layers and a linear output layer. The LSTM model consisted of a single LSTM layer, followed by a dropout layer and a dense output layer. Both models were trained using the Adam optimiser with mean squared error (MSE) as the loss function. Early stopping with a patience of five epochs and a validation split of 0.1 was applied during training. For the LSTM model, the input data were reshaped to a sequence length of one time step.
For the temperature anomaly models, both ANN and LSTM achieved optimal performance with 64 units, a dropout rate of 0.2, and a learning rate of 0.001. For the precipitation anomaly models, slightly different hyperparameters were selected, particularly the number of training epochs and the LSTM learning rate. Reporting these hyperparameters improves the transparency and reproducibility of the modelling framework.

3.6.2. Temperature Anomaly Forecasting

Table 5 shows the predictive performance of the three models, namely, ANN, LSTM, and GAM, on the test set using MSE, MAE, MBE, and MASE metrics. Among the three models, LSTM performed best, with the lowest MSE of 0.458 and MAE of 0.457, demonstrating better performance in handling temporal variations in temperature anomaly data. Though the errors were slightly higher for the ANN model (MSE = 0.568, MAE = 0.546), the GAM model performed moderately (MSE = 0.511, MAE = 0.507).
The MBE values indicate a small positive bias across all models—ANN: 0.062, LSTM: 0.087, and GAM: 0.169—indicating slight overpredictions. All models have MASE values below 1, with LSTM at 0.510, GAM at 0.567, and ANN at 0.610, indicating that all models perform better than a naïve one-step-ahead forecast. Based on the above analysis, it can be concluded that the LSTM model is the most accurate in predicting temperature anomalies, followed closely by the GAM model, and then the ANN model.
In Figure 12, we plot a comparison of observed temperature anomalies and predictions from all three models. We can see that LSTM predictions have closely tracked actual temperature anomalies, especially during periods of sudden change, whereas ANN predictions have shown larger differences. The predictions from the GAM have shown moderate differences between these two models, sometimes even smoothing out sudden spikes in temperature change. It is also noteworthy that during sudden spikes in temperature, such as during a heatwave or cold wave, LSTM predictions have been more accurate than those from the ANN and GAM models.
The results from the Diebold–Mariano test for differences in predictive accuracy between the ANN, LSTM, and GAM models for temperature anomalies are summarised in Table 6 and show a statistically significant difference in predictive accuracy between the ANN, LSTM, and GAM models. All three pairwise differences in predictive accuracy are significant at p-values < 0.001. The positive values of the DM test for the differences in predictive accuracy between the models “ANN vs. LSTM” and “ANN vs. GAM” show that the LSTM and GAM models have a superior performance compared to the ANN model. The negative value of the DM test for differences in predictive accuracy between the models “LSTM vs. GAM ” confirms the LSTM model’s superior performance compared to the GAM model.
This test was carried out using a HAC-corrected method for one-step-ahead forecast errors to account for autocorrelation and heteroscedasticity. It is ensured that the test is statistically sound. As suggested by this test, Figure 12 demonstrates that the predictions made by the LSTM model closely follow the sudden changes in temperature anomalies compared to the predictions made by ANN and GAM models. This is because the LSTM model is more effective at handling abnormal climatic events such as heatwaves and coldwaves than other models.
In Figure 13, a comparison is shown between the predictions made by the LSTM model and actual temperature anomalies. The accuracy of the predicted and actual values indicates the LSTM model’s ability to estimate the timing and magnitude of abrupt temperature changes precisely. In addition, the results from the Diebold–Mariano test, which showed high significance (p-value < 0.001) in Table 6, along with the performance metrics in Table 5, demonstrate the efficiency of the LSTM model for climate anomaly prediction.

3.6.3. Precipitation Anomaly Forecasting

The study also identified the optimal hyperparameter settings for the ANN and LSTM models for precipitation prediction. To ensure consistency in comparing the effectiveness of the ANN and LSTM models in forecasting precipitation anomalies, the same hyperparameter tuning methods were used for models trained on both temperature and precipitation anomaly data. As such, the optimal hyperparameters for both models are depicted in Table 4 and were then used to train the models on the precipitation anomaly data. The models’ effectiveness in forecasting precipitation anomalies is demonstrated by their performance on the test data, which provides a reliable basis for comparison.
Table 7 illustrates the predictive performance of the ANN, LSTM, and GAM models for the test data using MSE, MAE, MBE, and MASE for precipitation anomalies. From Table 7, we observe that the LSTM achieves the highest performance across most metrics compared to the other two models for predicting precipitation anomalies. For instance, the LSTM has the lowest MSE of 0.187 and MAE of 0.111 compared to the other two models. To be precise, the MSE of the LSTM model is lower than that of the ANN model (0.188) and GAM model (0.216). Similarly, the LSTM model’s MAE is lower at 0.111 than that of the ANN model at 0.127, and that of the GAM model is at 0.124.
The MBE values for the three models are close to zero, indicating that they do not show significant bias in their precipitation anomaly predictions. For example, the ANN model shows a slight positive bias in its precipitation anomaly predictions. This implies that the ANN model overpredicts precipitation anomalies. This is because the MBE of the ANN model is 0.005. On the other hand, the LSTM and GAM models show a slight negative bias in their precipitation anomaly predictions. This implies that the two models underpredict precipitation anomalies. This is because the MBE values for the two models are −0.009 and −0.004, respectively.
In all the models, the MASE is greater than 1. This indicates that none of the models performs better than the naïve model. From the figure above, it can also be observed that the lowest MASE is obtained with the LSTM model (1.873), followed by the GAM model (2.089) and the ANN model (2.141). This indicates that the LSTM model has better predictive power than the other two models, even though the precipitation anomaly values are random.
Figure 14 illustrates the comparison of precipitation anomalies with their predicted values using all models. The LSTM model’s predicted precipitation values are very close to the actual precipitation anomalies, whereas the ANN model shows larger variations. The GAM model can predict the trend of precipitation anomalies, but it cannot capture the sudden variations. The LSTM model performs better than the other two, possibly because it can capture temporal dependencies in precipitation anomalies.
The DM test result shown in Table 8 suggests that the difference in forecast accuracy between the ANN and LSTM models for precipitation anomalies is not statistically significant (DM = 0.337, p = 0.736). Since the p-value is greater than the standard significance levels (0.01, 0.05, and 0.10), the null hypothesis of equal predictive accuracy cannot be rejected. This implies that although there are small variations in the error measures, the ANN and LSTM models have similar forecasting capabilities for precipitation anomalies.
The comparisons with the GAM model are statistically significant, and both the ANN and LSTM models perform better than it (p-value < 0.001). This suggests that machine learning models are more appropriate for precipitation anomaly modelling than the semi-parametric GAM.
The lack of a significant difference in the performance of ANN and LSTM may be due to the high variability of precipitation data, which is often irregular or intermittent, characterised by frequent occurrences of zeros or low values interspersed with sporadic high values. This may be due to the nature of precipitation data, which makes it difficult for even the most complex temporal models to capture precipitation dynamics accurately; hence, the similarity in predictive accuracy between ANN and LSTM.
In Figure 15, a comparative analysis of the predictions from the ANN, LSTM, and GAM models for precipitation anomaly predictions over three representative segments of the test data set is presented. A zoomed-in version of the predictions has been provided, highlighting the periods of low variability with sharp precipitation increases.
Across all data segments, the predictions from the ANN and LSTM models are comparable, as supported by the non-significant Diebold–Mariano test. Although the LSTM model has been found to track rapid increases in precipitation levels slightly better during moderate precipitation events, the ANN model has been found to smooth predictions. The predictions from the GAM model are much smoother, especially in the middle segment, where they smooth out sharp variations. Although the smoothing effect allows the GAM model to track the overall trend, it tends to respond poorly to rapid increases in precipitation.
In the final section, the extreme precipitation event, all models slightly underestimate the peak magnitude. However, the ANN and LSTM models better capture the timing and shape of the observed anomaly than the GAM model does. These visual results confirm the quantitative analysis, showing the difficulties in modelling intermittent and skewed precipitation anomalies and the benefits of using machine learning models, despite the lack of statistical significance in the differences between the neural network models.

4. Discussion

The results of this study are significant for providing information on how climate change manifests in Thohoyandou. From the BEAST decomposition result, there is an increase in temperature anomaly trend by 0.025 °C every year. This indicates local warming in the study area. This result is consistent with other studies that show that an increase in temperature is one of the clearest manifestations of climate change and is strongly related to human activities, such as greenhouse gas emissions and land surface changes [2,3]. The result of this study is significant because local warming is important for understanding climate change, especially because large-scale research on climate change does not always show how it is expressed across regions of the world [23]. In this regard, this study is significant in providing information on how climate change is being expressed in a small urban centre in Limpopo Province.
These results are also consistent with other results from larger regions within Africa and Southern Africa. For example, ref. [24] found that Africa is experiencing rapidly rising surface temperatures under low-mitigation scenarios, and Southern Africa is among the regions expected to show a strong response to this effect. This is consistent with the warming trend found within Thohoyandou. The results indicate that the warming trend observed in Thohoyandou is not isolated but part of a larger climatic change that has already been reported in other areas. Although the research subject in this study was Thohoyandou, it may be considered a typical representative of a wide range of small urban centres in subtropical southern Africa with comparable climatic conditions and urban development trends. Hence, the methodological framework of this study may be applied in other cities with comparable climatic characteristics.
It is also important to consider that changes in temperature within the specific area may be influenced by global climate change, as well as by urban development and land-use changes. Urban development and changes in land use could also contribute to increased temperatures in the specific area. However, the fact that the specific study did not directly measure the impacts of urban development on temperature increase should be considered. Nonetheless, the fact that the temperature increase in the specific area is consistent with the broader regional and global increases, as indicated in previous climate change studies [2,24].
However, the study area of Thohoyandou could be considered representative of many small urban centres within the subtropical regions of Southern Africa that experience similar climatic conditions and patterns of urban development. Thus, the research’s methodological framework could apply to other cities with similar climatic conditions. However, it is also important to note that factors such as land-use change and geographic factors can influence the extent of climate change. Thus, the research is important and applicable to the case study of Thohoyandou and similar towns that experience similar climatic conditions.
The results for rainfall anomaly revealed a weak positive trend; however, changes are abrupt and extreme. This is in line with other studies that have shown that climate change is often felt as changes in rainfall variability rather than in average rainfall [8,21]. In other words, local adaptation strategies should focus more on managing floods, droughts, and rainfall uncertainty than on average rainfall values. The rainfall results also support the difficulty of predicting rainfall using linear trends in subtropical areas, given their intermittence.
The highly irregular precipitation behaviour observed in this study is consistent with earlier research on rainfall variability in Africa. In fact, ref. [10] demonstrated that short-term rainfall prediction is still a difficult task even with the aid of advanced machine learning techniques, owing to the frequent occurrence of zeros and sometimes extreme values in rainfall data. Similarly, ref. [20] demonstrated that rainfall prediction using advanced techniques such as LSTMs remains a major challenge compared to temperature prediction. This is consistent with the observation made in this study that precipitation anomalies are much more difficult to predict than temperature anomalies.
The results from the forecasting models also show clear differences in performance. For temperature anomalies, the LSTM model performed better than the ANN and GAM models, with lower prediction error and superior forecast accuracy, as indicated by the Diebold–Mariano test. This result agrees with studies showing that LSTM models are appropriate for sequential data, as they can effectively capture temporal dependencies and nonlinear relationships in the data [12,14,16]. Therefore, the superiority of the LSTM model in this study aligns with the growing literature suggesting that deep learning models can be useful for modelling time series related to climate.
The LSTM model’s strong performance in temperature forecasting has practical implications. For example, precise short-term temperature anomaly forecasts can help local authorities issue alerts on temperature-related issues. It can also help farmers plan agricultural activities during peak temperature stress. In areas like Thohoyandou, where livelihoods are closely linked to local weather, temperature forecasting can help support short-term adaptation planning.
It was also determined that the forecasts of precipitation anomalies were not very accurate. Although the LSTM model produced lower forecast errors than the ANN and GAM models, there was no significant difference between the ANN and LSTM models. Moreover, it was determined that all models yielded MASE values greater than 1, indicating that none performed better than the naïve model in precipitation forecasting. This situation again emphasises how hard it is to forecast rainfall. This situation is consistent with the literature, which states that rainfall is highly skewed, intermittent, and zero-inflated [10,20]. It should not be concluded that the models performed poorly in rainfall forecasting in this study. It is necessary to emphasise that precipitation is a very complex phenomenon.
It is also important to acknowledge several limitations of this study. Firstly, the analysis was conducted at a single location, which may limit the generalisation of the findings to other regions with different climatic and land–atmosphere interaction characteristics. Secondly, precipitation forecasting remains particularly challenging due to the intermittent and zero-inflated nature of rainfall data, especially at the hourly scale. As a result, precipitation anomaly forecasts should be interpreted as indicative of elevated risk rather than deterministic predictions.
Future research should extend the analysis to a broader spatial scale, including multiple stations across Limpopo Province, and investigate hybrid modelling approaches that combine physical climate models with machine learning techniques. The inclusion of additional atmospheric and land-surface variables may also improve forecasting accuracy.
The GAM model also plays a significant role in this study. Although the GAM model did not outperform the LSTM model, it was useful as a transparent and interpretable statistical model for comparison. This is particularly important because GAM can handle nonlinear relationships while being easier to interpret than deep learning methods [18]. Previous research in South Africa has also shown that GAM is useful in drought forecasting and hydroclimatic applications [19]. For decision-makers who prefer more interpretable models, GAM is a viable option, though its performance is slightly lower than that of advanced machine learning techniques.
These results have significant implications for local climate adaptation strategies. First, the warming trend underscores the need for adaptation measures to mitigate the effects of increased heat exposure. These may include building design, urban shading, and heat-stress mitigation for exposed populations [22]. On the other hand, the high rainfall variability indicates the need for flexible adaptation options in water management, including stormwater management, rainwater harvesting, and drought management in agriculture. These results also point to the need to use local data in adaptation planning, since local climate risks may not always be captured in large-scale projections [9,26].
The research findings from the study have established that the use of a combination of methods, including anomaly detection, BEAST decomposition, machine learning, and statistical modelling, is a useful framework for explaining local climate change in a data-scarce region. This is significant because it contributes to the body of knowledge on climate forecasting and local climate risk analysis. At the same time, the research provides insights that may inform effective strategies for climate change adaptation in Thohoyandou and other urban centres.

5. Conclusions

The study examined 35 years of hourly temperature and precipitation data from Thohoyandou to identify local signs of climate change and assess the effectiveness of various forecasting models. Using the BEAST method, it was established that temperatures increased, with anomalies rising at an average rate of 0.025 °C annually. On the other hand, precipitation was highly unpredictable, exhibiting abrupt, extreme changes without any trend.
In terms of forecasting performance, the Long Short-Term Memory model outperformed the Artificial Neural Network and the Generalised Additive Model in predicting temperature anomalies. However, in the case of precipitation, it proved very difficult for all three models. All three models showed Mean Absolute Scaled Error greater than 1, indicating that none performed better than a naïve model in rainfall forecasting. This is a clear indication of the inherent difficulty of rainfall modelling, given its intermittent and stochastic nature, especially at the hourly scale.
The findings show that the use of anomaly detection, BEAST decomposition, machine learning, and statistical modelling is an important tool for analysing local climate change. The findings also underscore the importance of local-scale research in analysing the impacts of global climate change. The research will be important in giving useful insights to policy and planning circles on how to address the impacts of climate change in vulnerable communities such as Thohoyandou. Future research would be extended to a larger spatial scale, including other stations in Limpopo Province. It would also focus on hybrid modelling frameworks combining physical climate models and machine learning methods. More atmospheric and land-surface parameters would also improve the forecast accuracy.
It is also important to note that precipitation is challenging to model due to its intermittent, zero-inflated nature and strong stochastic properties, especially at the hourly scale. Therefore, anomalies in precipitation forecasts should be viewed as an indication of higher risk and not as deterministic. Additionally, there is a lack of quantification of uncertainty and of probabilistic forecasts.
As future research, it is recommended that the research be generalised to a broader spatial scale, including the entire Limpopo Province. Additionally, the use of more variables from the atmosphere and land surface, and hybrid models that incorporate physical climate and machine learning techniques, should be explored. To conclude, the paper has demonstrated the potential of combining statistical decomposition, machine learning, and interpretable models to advance knowledge of the local impacts of global climate change.

Author Contributions

Conceptualisation, M.M., C.S. and T.R.; methodology, M.M.; software, M.M.; validation, M.M., C.S. and T.R.; formal analysis, M.M.; investigation, M.M., C.S. and T.R.; data curation, M.M.; writing—original draft preparation, M.M.; writing—review and editing, M.M., C.S. and T.R.; visualisation, M.M.; supervision, C.S. and T.R.; project administration, C.S. and T.R.; funding acquisition, M.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the DST-CSIR National e-Science Postgraduate Teaching and Training Platform (NEPTTP): http://www.escience.ac.za/, accessed on 15 January 2025.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The historical weather data used in this study, comprising hourly temperature (2 m) and precipitation (snow + rain) records over a 35-year period, were obtained from the Historical Weather API, available at https://open-meteo.com/en/docs/historical-weather-api (accessed on 5 February 2025). The analytic data and data in brief can be accessed from https://github.com/csigauke/An-Analysis-Of-How-Local-Weather-Patterns-Are-Affected-by-Climate-Change (accessed on 6 November 2025).

Acknowledgments

The support of the DST-CSIR National e-Science Postgraduate Teaching and Training Platform (NEPTTP) provided for this research is acknowledged. The opinions expressed and conclusions arrived at are those of the authors and are not necessarily to be attributed to the NEPTTP. In addition, the authors thank the anonymous reviewers for their helpful comments on this paper.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in this study’s design; in the collection, analyses, or interpretation of data; in the writing of this manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
ANNArtificial Neural Network
BEASTBayesian Estimator of Abrupt change, Seasonal change, and Trend
DMDiebold–Mariano
GARCHGeneralized Autoregressive Conditional Heteroskedasticity
GAMGeneralised Additive Model
LASSOLeast Absolute Shrinkage and Selection Operator
LSTMLong Short-Term Memory
MAEMean Absolute Error
MASEMean Absolute Scaled Error
MBEMean Bias Error
MLMachine Learning
RMSERoot Mean Square Error
SARIMASeasonal Autoregressive Integrated Moving Average

References

  1. Angra, D.; Sapountzaki, K. Climate change affecting forest fire and flood risk: Facts, predictions, and perceptions in central and South Greece. Sustainability 2022, 14, 13395. [Google Scholar] [CrossRef]
  2. Romm, J. Climate Change: What Everyone Needs to Know; Oxford University Press: Oxford, UK, 2022. [Google Scholar]
  3. Stott, P. How climate change affects extreme weather events. Science 2016, 352, 1517–1518. [Google Scholar] [CrossRef]
  4. Rankoana, S.A. Perceptions of climate change and the potential for adaptation in a rural community in Limpopo Province, South Africa. Sustainability 2016, 8, 672. [Google Scholar] [CrossRef]
  5. Nkamisa, M.; Ndhleve, S.; Nakin, M.D.; Mngeni, A.; Kabiti, H.M. Analysis of trends, recurrences, severity and frequency of droughts using standardised precipitation index: Case of OR Tambo District Municipality, Eastern Cape, South Africa. Jàmbá J. Disaster Risk Stud. 2022, 14, 1147. [Google Scholar] [CrossRef] [PubMed]
  6. Ziervogel, G.; New, M.; Archer van Garderen, E.; Midgley, G.; Taylor, A.; Hamann, R.; Stuart-Hill, S.; Myers, J.; Warburton, M. Climate change impacts and adaptation in South Africa. Wiley Interdiscip. Rev. Clim. Chang. 2014, 5, 605–620. [Google Scholar] [CrossRef]
  7. Han, H.; Liu, Z.; Barrios Barrios, M.; Li, J.; Zeng, Z.; Sarhan, N.; Awwad, E.M. Time series forecasting model for non-stationary series pattern extraction using deep learning and GARCH modeling. J. Cloud Comput. 2024, 13, 2. [Google Scholar] [CrossRef]
  8. Hernanz, A.; García-Valero, J.A.; Domínguez, M.; Rodríguez-Camino, E. A critical view on the suitability of machine learning techniques to downscale climate change projections: Illustration for temperature with a toy experiment. Atmos. Sci. Lett. 2022, 23, e1087. [Google Scholar] [CrossRef]
  9. Giorgi, F. Thirty years of regional climate modeling: Where are we and where are we going next? J. Geophys. Res. Atmos. 2019, 124, 5696–5723. [Google Scholar] [CrossRef]
  10. Gahwera, T.A.; Eyobu, O.S.; Isaac, M. Analysis of machine learning algorithms for prediction of short-term rainfall amounts using Uganda’s Lake Victoria Basin weather dataset. IEEE Access 2024, 12, 63361–63380. [Google Scholar] [CrossRef]
  11. Akazan, A.-C.; Mbingui, V.R.; N’guessan, G.L.R.; Karambal, I. Localized weather prediction using Kolmogorov-Arnold network-based models and deep RNNs. arXiv 2025, arXiv:2505.22686. [Google Scholar] [CrossRef]
  12. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  13. Chang, S.; Zhang, Y.; Han, W.; Yu, M.; Guo, X.; Tan, W.; Cui, X.; Witbrock, M.; Hasegawa-Johnson, M.A.; Huang, T.S. Dilated recurrent neural networks. In Advances in Neural Information Processing Systems 30; Curran Associates, Inc.: Long Beach, CA, USA, 2017; pp. 77–87. [Google Scholar]
  14. Smyl, S. A hybrid method of exponential smoothing and recurrent neural networks for time series forecasting. Int. J. Forecast. 2020, 36, 75–85. [Google Scholar] [CrossRef]
  15. Makridakis, S.; Spiliotis, E.; Assimakopoulos, V. The M4 Competition: Results, findings, conclusion and way forward. Int. J. Forecast. 2018, 34, 802–808. [Google Scholar] [CrossRef]
  16. Lara-Benítez, P.; Carranza-García, M.; Riquelme, J.C. An experimental review on deep learning architectures for time series forecasting. Int. J. Neural Syst. 2021, 31, 2130001. [Google Scholar] [CrossRef]
  17. Gamboa, J.C.B. Deep learning for time-series analysis. arXiv 2017, arXiv:1701.01887. [Google Scholar] [CrossRef]
  18. Bonsoms, J.; Ninyerola, M. Comparison of linear, generalized additive models and machine learning algorithms for spatial climate interpolation. Theor. Appl. Climatol. 2024, 155, 1777–1792. [Google Scholar] [CrossRef]
  19. Mathivha, F.; Sigauke, C.; Chikoore, H.; Odiyo, J. Short-term and medium-term drought forecasting using generalized additive models. Sustainability 2020, 12, 4006. [Google Scholar] [CrossRef]
  20. Dotse, S.Q. Deep learning—Based long short-term memory recurrent neural networks for monthly rainfall forecasting in Ghana, West Africa. Theor. Appl. Climatol. 2024, 155, 3033–3045. [Google Scholar] [CrossRef]
  21. Davenport, F.V.; Diffenbaugh, N.S. Using machine learning to analyze physical causes of climate change: A case study of US Midwest extreme precipitation. Geophys. Res. Lett. 2021, 48, e2021GL093787. [Google Scholar] [CrossRef]
  22. Zhou, J.; Teuling, A.J.; Seneviratne, S.I.; Hirsch, A.L. Soil moisture–temperature coupling increases population exposure to future heatwaves. Earth’s Future 2024, 12, e2024EF004697. [Google Scholar] [CrossRef]
  23. Mzezewa, J.; Gwata, E. The nature of rainfall at a typical semi-arid tropical ecotope in Southern Africa and options for sustainable crop production. In Crop Production Technologies; In Tech: London, UK, 2012; pp. 95–112. [Google Scholar]
  24. Engelbrecht, F.; Adegoke, J.; Bopape, M.J.; Naidoo, M.; Garland, R.; Thatcher, M.; McGregor, J.; Katzfey, J.; Werner, M.; Ichoku, C.; et al. Projections of rapidly rising surface temperatures over Africa under low mitigation. Environ. Res. Lett. 2015, 10, 085004. [Google Scholar] [CrossRef]
  25. Hersbach, H.; Bell, B.; Berrisford, P.; Hirahara, S.; Horányi, A.; Muñoz-Sabater, J.; Thépaut, J.-N. The ERA5 global reanalysis. Q. J. R. Meteorol. Soc. 2020, 146, 1999–2049. [Google Scholar] [CrossRef]
  26. McCulloch, W.S.; Pitts, W. A logical calculus of the ideas immanent in nervous activity. Bull. Math. Biophys. 1943, 5, 115–133. [Google Scholar] [CrossRef]
  27. Rosenblatt, F. The perceptron: A probabilistic model for information storage and organization in the brain. Psychol. Rev. 1958, 65, 386–408. [Google Scholar] [CrossRef] [PubMed]
  28. Rumelhart, D.E.; Hinton, G.E.; Williams, R.J. Learning representations by back-propagating errors. Nature 1986, 323, 533–536. [Google Scholar] [CrossRef]
  29. GeeksforGeeks. What Is LSTM—Long Short Term Memory? GeeksforGeeks. 2024. Available online: https://www.geeksforgeeks.org/deep-learning/deep-learning-introduction-to-long-short-term-memory/ (accessed on 9 May 2025).
  30. Yang, H.; Hu, J.; Cai, J.; Wang, Y.; Chen, X.; Zhao, X.; Wang, L. A new MC-LSTM network structure designed for regression prediction of time series. Neural Process. Lett. 2023, 55, 8957–8979. [Google Scholar] [CrossRef]
  31. Alizadegan, H.; Rashidi Malki, B.; Radmehr, A.; Karimi, H.; Ilani, M.A. Comparative study of long short-term memory (LSTM), bidirectional LSTM, and traditional machine learning approaches for energy consumption prediction. Energy Explor. Exploit. 2025, 43, 281–301. [Google Scholar] [CrossRef]
  32. Ranstam, J.; Cook, J.A. Lasso regression. Br. J. Surg. 2018, 105, 1348. [Google Scholar] [CrossRef]
  33. Jolliffe, I.T.; Trendafilov, N.T.; Uddin, M. A modified principal component technique based on the LASSO. J. Comput. Graph. Stat. 2003, 12, 531–547. [Google Scholar] [CrossRef]
  34. Soper, D.S. Greed is good: Rapid hyperparameter optimization and model selection using greedy k-fold cross validation. Electronics 2021, 10, 1973. [Google Scholar] [CrossRef]
  35. Jiang, X.; Xu, C. Deep learning and machine learning with grid search to predict later occurrence of breast cancer metastasis using clinical data. J. Clin. Med. 2022, 11, 5772. [Google Scholar] [CrossRef] [PubMed]
  36. Ranganai, E.; Sigauke, C. Capturing long-range dependence and harmonic phenomena in 24-h solar irradiance forecasting: A quantile regression robustification via forecasts combination approach. IEEE Access 2020, 8, 172204–172218. [Google Scholar] [CrossRef]
  37. Zhao, K.; Wulder, M.A.; Hu, T.; Bright, R.; Wu, Q.; Qin, H.; Li, Y.; Toman, E.; Mallick, B.; Zhang, X.; et al. Detecting change-point, trend, and seasonality in satellite time series data to track abrupt changes and nonlinear dynamics: A Bayesian ensemble algorithm. Remote. Sens. Environ. 2019, 232, 111181. [Google Scholar] [CrossRef]
Figure 1. Location map of Thohoyandou, Limpopo Province, South Africa.
Figure 1. Location map of Thohoyandou, Limpopo Province, South Africa.
Earth 07 00057 g001
Figure 2. Structure of multilayer neural network sourced from [29].
Figure 2. Structure of multilayer neural network sourced from [29].
Earth 07 00057 g002
Figure 3. Structure of LSTM [30].
Figure 3. Structure of LSTM [30].
Earth 07 00057 g003
Figure 4. Plot of the relationship between hourly temperature and precipitation (1990–2025).
Figure 4. Plot of the relationship between hourly temperature and precipitation (1990–2025).
Earth 07 00057 g004
Figure 5. Time series of hourly temperature and precipitation (1990–2025).
Figure 5. Time series of hourly temperature and precipitation (1990–2025).
Earth 07 00057 g005
Figure 6. Density and Q-Q plots of temperature and precipitation.
Figure 6. Density and Q-Q plots of temperature and precipitation.
Earth 07 00057 g006
Figure 7. Time series of temperature and precipitation anomalies (1990–2025). (a) Temperature anomalies (1990–2025). (b) Precipitation anomalies (1990–2025).
Figure 7. Time series of temperature and precipitation anomalies (1990–2025). (a) Temperature anomalies (1990–2025). (b) Precipitation anomalies (1990–2025).
Earth 07 00057 g007
Figure 8. BEAST decomposition for temperature and precipitation anomalies in Thohoyandou (1990–2025). (a) Temperature anomalies. (b) Precipitation anomalies.
Figure 8. BEAST decomposition for temperature and precipitation anomalies in Thohoyandou (1990–2025). (a) Temperature anomalies. (b) Precipitation anomalies.
Earth 07 00057 g008
Figure 9. Correlation heatmap of meteorological variables and anomalies.
Figure 9. Correlation heatmap of meteorological variables and anomalies.
Earth 07 00057 g009
Figure 10. Feature selection for temperature anomaly.
Figure 10. Feature selection for temperature anomaly.
Earth 07 00057 g010
Figure 11. Feature selection for precipitation anomaly.
Figure 11. Feature selection for precipitation anomaly.
Earth 07 00057 g011
Figure 12. Comparison of ANN, LSTM, and GAM predictions with observed temperature anomalies.
Figure 12. Comparison of ANN, LSTM, and GAM predictions with observed temperature anomalies.
Earth 07 00057 g012
Figure 13. Zoomed-in view of LSTM predictions compared with observed temperature anomalies.
Figure 13. Zoomed-in view of LSTM predictions compared with observed temperature anomalies.
Earth 07 00057 g013
Figure 14. Comparison of ANN, LSTM, and GAM predictions with observed precipitation anomalies.
Figure 14. Comparison of ANN, LSTM, and GAM predictions with observed precipitation anomalies.
Earth 07 00057 g014
Figure 15. Zoomed-in view of ANN, LSTM, and GAM predictions for precipitation anomalies.
Figure 15. Zoomed-in view of ANN, LSTM, and GAM predictions for precipitation anomalies.
Earth 07 00057 g015
Table 1. Summary statistics of hourly temperature, precipitation, and anomalies.
Table 1. Summary statistics of hourly temperature, precipitation, and anomalies.
StatisticTemp (°C)Precip (mm)Temp_Anomaly (°C)Precip_Anomaly (mm)
Count308,616308,616308,616308,616
Mean20.1520.1180.0000.000
Minimum4.4000.000−12.998−0.277
Maximum41.30018.60019.93818.341
Std. Deviation5.3750.5114.6240.503
Skewness0.17910.8040.51710.756
Kurtosis−0.240186.258−0.084188.903
Table 2. Stationarity test results for temperature and precipitation anomalies.
Table 2. Stationarity test results for temperature and precipitation anomalies.
VariableTestStatisticp-ValueStationary (5%)
Temp AnomalyADF−39.1540.000Yes
Temp AnomalyKPSS1.2230.010No
Precip AnomalyADF−48.9000.000Yes
Precip AnomalyKPSS1.4380.010No
Table 3. BEAST summary results.
Table 3. BEAST summary results.
VariableChange PointsTrend Slope per Year
Temperature Anomalies1992–20200.0250
Precipitation Anomalies1991–20240.0037
Table 4. Optimal hyperparameters for ANN and LSTM models.
Table 4. Optimal hyperparameters for ANN and LSTM models.
Target VariableModelBatch SizeEpochsLearning RateUnitsDropout Rate
Temperature AnomalyANN32500.001640.2
LSTM32500.001640.2
Precipitation AnomalyANN64500.001320.2
LSTM64200.0005320.2
Table 5. Test set performance of ANN, LSTM, and GAM models for temperature anomalies.
Table 5. Test set performance of ANN, LSTM, and GAM models for temperature anomalies.
ModelMSEMAEMBEMASE
ANN0.5680.5460.0620.610
LSTM0.4580.4570.0870.510
GAM0.5110.5070.1690.567
Table 6. Diebold–Mariano (DM) test comparing predictive accuracy of ANN, LSTM, and GAM models for temperature anomalies.
Table 6. Diebold–Mariano (DM) test comparing predictive accuracy of ANN, LSTM, and GAM models for temperature anomalies.
ComparisonDM Statisticp-Value
ANN vs. LSTM21.687<0.001
ANN vs. GAM7.918<0.001
LSTM vs. GAM−11.530<0.001
Table 7. Test set performance of ANN, LSTM, and GAM models for precipitation anomalies.
Table 7. Test set performance of ANN, LSTM, and GAM models for precipitation anomalies.
ModelMSEMAEMBEMASE
ANN0.1880.1270.0052.141
LSTM0.1870.111−0.0091.873
GAM0.2160.124−0.0042.089
Table 8. Diebold–Mariano test comparing predictive accuracy of ANN, LSTM, and GAM models for precipitation anomalies.
Table 8. Diebold–Mariano test comparing predictive accuracy of ANN, LSTM, and GAM models for precipitation anomalies.
ComparisonDM Statisticp-Value
ANN vs. LSTM0.3370.736
ANN vs. GAM−4.657<0.001
LSTM vs. GAM−4.506<0.001
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.

Share and Cite

MDPI and ACS Style

Mukhaninga, M.; Sigauke, C.; Ravele, T. Comparative Performance of LSTM, ANN, and GAM in Predicting Precipitation and Temperature Anomalies Under Accelerated Warming: Evidence from Thohoyandou, South Africa (1990–2025). Earth 2026, 7, 57. https://doi.org/10.3390/earth7020057

AMA Style

Mukhaninga M, Sigauke C, Ravele T. Comparative Performance of LSTM, ANN, and GAM in Predicting Precipitation and Temperature Anomalies Under Accelerated Warming: Evidence from Thohoyandou, South Africa (1990–2025). Earth. 2026; 7(2):57. https://doi.org/10.3390/earth7020057

Chicago/Turabian Style

Mukhaninga, Mueletshedzi, Caston Sigauke, and Thakhani Ravele. 2026. "Comparative Performance of LSTM, ANN, and GAM in Predicting Precipitation and Temperature Anomalies Under Accelerated Warming: Evidence from Thohoyandou, South Africa (1990–2025)" Earth 7, no. 2: 57. https://doi.org/10.3390/earth7020057

APA Style

Mukhaninga, M., Sigauke, C., & Ravele, T. (2026). Comparative Performance of LSTM, ANN, and GAM in Predicting Precipitation and Temperature Anomalies Under Accelerated Warming: Evidence from Thohoyandou, South Africa (1990–2025). Earth, 7(2), 57. https://doi.org/10.3390/earth7020057

Article Metrics

Back to TopTop