Analyzing and Forecasting The Weather Conditions in Jordan Using Machine Learning Techniques
Analyzing and Forecasting The Weather Conditions in Jordan Using Machine Learning Techniques
[email protected] [email protected]
Abstract—Weather forecasting is an important research of RNN that often overcome some shortcomings in
field due to its impact on a wide variety of life aspects. The traditional RNN.
traditional way of weather forecasting is based on complex
physical models that describe the hydrodynamic behavior of In this work, we use deep machine learning to propose
the atmosphere. This way is costly, time consuming, often accurate model for weather forecasting in Jordan [4]. We
inaccurate and requires supercomputers to make predictions. propose a scheme that integrates multiphase training with
In this paper, we investigated the performance of machine considering the data of surrounding locations to the target
learning algorithms in predicting the weather conditions in location [4]. During the first phase, the model is trained on
Jordan for a short period. We start by analyzing the used the dataset of all locations, while in the second phase, the
dataset of the weather conditions of the 12 Jordanian model is trained on the dataset of the target location to make
governorates over past 13 years, where the long-term trend predictions. Using this technique, we improve the MSE by
shows 0.3-°C rise in the average temperature and 10-mm one order of magnitude, from 3.48 ×10-5 to 1.78×10-6.
decrease in the average annual precipitation. We propose a
prediction model based on encoder-decoder architecture and The rest of the paper is organized as follows. The next
bidirectional long short-term memory cells (ED-BiLSTM). We section discusses some related work to weather forecasting.
carefully tune and train this model and show the importance of In Section III, we give some analysis of the used dataset.
integrating the data of nearby locations to the target location’s Section IV presents the experimental environments that were
data to improve the model accuracy. Also, we show that the used in this work. Section V describes the dataset
model accuracy improves significantly when adding training preprocessing. The base model and its architecture are
instances of other locations. The proposed tuned model trained presented in Section VI. Section VII presents the
on the train data of 16 locations and accepting regional experiments that were carried to enhance the base model. In
weather conditions at the input has very low mean squared Section VIII, we explain the structure of the proposed model.
error of 1.78×10-6 in predicting Amman’s weather for the next Section IX presents the experiments to improve the results of
24 hours. weather forecasting in Jordan. Section X gives discussion of
the results. Finally, in Section XI, we provide conclusion of
Keywords—recurrent neural network, long short-term memory,
our work and suggest some future work.
BiLSTM, Jordan, weather forecasting
Jordan is a country situated in the north of the Arabian We start this section by reviewing important papers that
Peninsula and in western Asia, it lies between 29° and 34° are closely related to our proposed model. Then, we review
North and 34° and 40° East. It has an estimated population of some work related to weather forecasting in Jordan using
11 million and an area of about 89,342 km2. The land ML techniques. The last subsection discusses papers about
constitutes about 99.3% of the entire area, while the water weather forecasting outside Jordan using ML techniques.
constitutes about 0.7% [1]. Jordan is a semi-dry country, and
it is considered one of the 10 poorest countries in the world A. Direct Research Work
in terms of water. In fact, the desert covers more than three- Zaytar and Amrani suggested LSTM model to predict
quarters of Jordan’s area, while the western part of the three weather elements: air temperature, wind speed, and
country has arable land as it receives adequate rainfall over humidity in nine Moroccan cities for the next 24 and 72
the winter season [2]. In general, Jordan climate is a hours. The suggested model achieves mean squared error
combination of the Mediterranean and desert climates, where (MSE) values between 0.00516 and 0.00839 for the next 24
the Mediterranean climate is prevailing in the northern and hours, and between 0.00675 and 0.01053 for the next 72
western regions of the country, while the desert climate hours [5]. A stacked autoencoder LSTM (SAE–LSTM)
prevails in the rest of the country. The weather is hot and dry model was suggested by Jaseena and Kovoor to predict the
in summer and cooler with some precipitation in winter [2]. wind speed at Tamil Nadu state in India. The suggested
model achieved mean absolute error (MAE), root mean
Recurrent neural networks (RNN) are a special form of squared error (RMSE), and coefficient of determination (R2)
artificial neural network (ANN) that are commonly applied of 0.3982, 0.5969, and 96.20, respectively [6]. Hewage et al.
in applications that have sequential and time series datasets suggested two different deep learning (DL) models: LSTM
like weather forecasting, text translation, and audio and temporal convolutional networks (TCN) to predict 10
recognition. Their utility stems from their ability to weather elements over the near future. Also, the authors
remember and utilize information from previous time investigated the effectiveness of BiLSTM and multiphase
steps [3]. Long short-term memory cells (LSTM) and training in making predictions. The results reveal that the
bidirectional LSTM layers (BiLSTM) are successful versions LSTM model outperformed the TCN model and BiLSTM
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
/23/$31.00 ©2023 IEEE 110
model achieved better results than the other two suggested 2009 and 2021. This data shows that the average temperature
models and multiphase training [7]. in Jordan has risen about 0.3 °C in this period. Table II
shows the average annual precipitation and change of
B. Weather Forecasting in Jordan using Machine Learning precipitation in all Jordanian governorates between 2009 and
Zahran et al. suggested feed forward ANN based on 2021. This data shows that the average perception in Jordan
backpropagation (BP) model to forecast the future rainfalls has decreased by 10 mm in this period.
in Jordan. The datasets used in this study include rainfall
readings for four regions in Jordan: Amman, Irbid, TABLE I. THE AVERAGE TEMPERATURE AND CHANGE OF AVERAGE
Ruwaished, and AL-Ghour between 1977 and 2008. The TEMPERATURE IN JORDAN.
results showed that the suggested model achieves prediction Average Temperature
accuracies of 85.63%, 86.26%, 77.73%, and 79% for Governorate
Temperature (°C) Change (°C)
Amman, Irbid, AL-Ghour, and Ruwaished, respectively [8]. Amman 18.1 +0.3
Odeh suggested feed forward network (FFN) for the Mafraq 16.7 +0.4
minimum air temperature forecasting for four months: Irbid 18.2 +0.3
Jerash 17.4 +0.3
January, April, July, and October in Amman. The author
Ajloun 16.6 +0.3
used daily readings of minimum temperature for the four Zarqa 17.6 +0.4
months from 1973 to 2003 in building and evaluating the Balqa 18 .0 +0.3
proposed model. The results revealed that the FFN achieved Karak 17.0 +0.3
R2 around 0.99 and MSE of 1% [9]. Tafilah 16.6 +0.3
Aqaba 24.8 +0.4
C. Weather Forecasting for Other Countries using Machine Madaba 16.7 +0.3
Maan 17.5 +0.4
Learning Average 17.9 +0.3
Khan and Maity proposed a DL model that combines a
one-dimensional convolutional neural network (Conv1D) TABLE II. THE AVERAGE ANNUAL PRECIPITATION AND CHANGE OF
with multi-layer perceptron (MLP) (Conv1D-MLP) to ANNUAL PRECIPITATION IN JORDAN.
predict the amount of precipitation from one to five days Annual Precipitation
ahead in the Maharashtra state in India. For one day ahead Governorate
Precipitation (mm) Change (mm)
prediction, Conv1D-MLP achieved a range of R2 values, Amman 405 -25
average Nash-Sutcliffe efficiency (NSE) and average RMSE Mafraq 180 -34
from 0.41 to 0.76, from 0.17 to 0.57, and from 5.81 to 17.45, Irbid 461 +21
Jerash 430 +18
respectively. Whereas, during the next five days prediction,
Ajloun 470 +23
the proposed model achieved a range of R2, NSE, and Zarqa 168 -28
average RMSE from 0.25 to 0.55, from 0.28 to 0.11, and Balqa 395 -27
from 6.6 to 24.19, respectively [10]. Chhetri et al. proposed a Karak 347 -19
combined model of BiLSTM and gated recurrent unit (GRU) Tafilah 360 -24
(BiLSTM-GRU) to predict the monthly rainfall in the Aqaba 30 -6
Simtokha district in Bhutan. Also, the authors compared the Madaba 350 -22
proposed model with six other models: linear regression, Maan 46 -9
Average 303.5 -10
LSTM, GRU, BiLSTM, MLP, and convolutional neural
network (CNN) to show the effectiveness of the proposed
model. The results showed that the proposed model gives
better results than the six other models. The proposed model
achieved MSE, RMSE, R2, and Pearson correlation Fig. 1 exhibits the monthly average temperature in
coefficient (PCC) values of 0.0075, 0.087, 0.870, and 0.938, Amman over the last 13 years. Fig. 2 exhibits the monthly
respectively [11]. average precipitation in Amman over the last 13 years.
Further analysis for the weather patterns and behaviors in all
Jordanian governorates is in [5].
III. DATASET ANALYSIS
In this paper, we used weather dataset for the 12
Jordanian governorates: Amman, Irbid, Zarqa, Jerash,
Ajloun, Mafraq, Madaba, Balqa, Karak, Tafilah, Aqaba, and
Maan with some areas surrounding Jordan, like Jerusalem,
Damascus, Cyprus, and Cairo. The dataset was obtained
from www.worldweartheronline.com, www.ncdc.noaa.gov,
power.larc.nasa.gov, and www.arabiaweather.com. The
dataset consists of hourly readings of the following
parameters: average air temperature, ultraviolet index,
atmospheric pressure, feels-like temperature, humidity, heat
index, and total precipitation from 1/1/2009 to
31/12/2021.Hence, the size of dataset is 12754560 elements
which are hourly readings of seven weather parameters for
16 locations for 13 years.
Fig. 1. Monthly average temperature in Amman.
Table I shows the average temperature and change of
average temperature in all Jordanian governorates between
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
111
VI. BASE MODEL
The base model of weather forecasting is called encoder-
decoder LSTM (ED-LSTM) and is based on the LSTM cell
[5]. The stochastic gradient descent (SGD) optimizer with
learning rate of 0.01 and a batch size of 128 is used in
training the model [5]. Also, we constructed sliding
windows, where each one uses the previous 120 hours of all-
weather parameters to predict the next nine hours [5]. Fig. 4
shows the architecture of the ED-LSTM base model. This
base model achieves MSE of 0.0136 on the test set.
V. DATA PREPROCESSING
As described in Section III, the dataset consists of hourly
readings of seven weather parameters. This dataset
preparation for training consists of several steps. Firstly, Fig. 4. The architecture of the ED-LSTM base model.
reading the dataset from a comma separated values (CSV)
file. Secondly, normalizing the dataset using min and max VII. EXPERIMENTS
scaler to maintain all the values in the range from -1 to +1 by In this section, we present the experiments that we have
applying the following equation: carried out on the base model to enhance its performance and
to achieve the best results.
pi − min ( pi )
pi = 2 × − 1 (1)
A. Optimizer Selection
max ( pi ) − min ( pi )
Thirdly, constructing temporal sliding windows to make In this experiment, we have tested several types of
the dataset suitable for the model training. Where each optimizers: Adaptive moment estimation (Adam), stochastic
window uses the values of consecutive past 120 hours of all- gradient descent with Momentum (M=0.9) and Nestrov
weather features as input to the model, and the range of a optimization, and root mean squared propagation
future hours like 9 and 24 hours of all-weather features as the (RMSProp). Fig. 5 shows a comparison between these four
model output as shown in Fig. 3. Then, the sliding windows optimizers in terms of MSE.
are shuffled randomly to avoid overfitting. Finally, the
shuffled sliding windows are split into three sets, 70% for
training, 15% for validation, and 15% for testing. The train
set is used to train and build the proposed model, the
validation set is used to give an initial evaluation of the
proposed model about new dataset, and the test set is used to
report the final evaluation of the model accuracy.
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
112
Nestrov, and SGD. So, Adam was chosen as the default D. Selecting the Number of Nodes per Layer
training optimizer for the next experiments. An additional experiment was performed to test the effect
of changing the number of nodes in the hidden layers on the
B. Cell Type Selection performance of the model. We tested two different
The aim of this experiment is to find the optimal type of configurations, the first one has the same large number of
cell for the base model by experimenting with two other nodes (512) in the five layers, while the second one has 512,
types of cells, GRU and BiLSTM, and compared them with 256, and 128 nodes in the encoder and 256 and 512 nodes in
LSTM. Fig. 6 shows the performance of each cell type in the decoder. The results obtained from this experiment reveal
terms of MSE. that the model that has same large number of nodes (512)
gives better MSE of 0.00012, while the other model gives
MSE of 0.00026. So, we adopt the large model in the next
experiments.
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
113
G. Effect of Prediction Period show which ones had the most impact on the model
This experiment was performed to identify the effect of performance.
increasing the time prediction on the model performance. In
fact, we have tested two different periods: m=9 and 24 hours. A. Base Scheme: Single-Input, Single-Output,1phase (SI-
The results of this experiment show that the MSE increases SO-1Ph)
from 4.97×10-6 for 9 hours to 3.48×10-5 for 24 hours. In In this experiment, we have trained the proposed model
general, the forecasts become less accurate and more on one location (e.g., Amman) to predict the weather
expensive as the prediction period increases. conditions for this location for the next 24h.
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
114
• Training on more data (the 2Ph models are better than We have carried out several experiments to enhance the
their corresponding 1Ph models). base model including, changing the optimizers, cell type,
number of hidden layers, number of nodes, normalization
Best results are obtained the model has regional input to techniques, and data type. We noticed that changing the
predict one location and is trained on data from other optimizers and normalization techniques have the greatest
locations (MI-So-2Ph). impact on improving the model performance. Furthermore,
the obtained results demonstrated that utilizing the historical
data from surrounding areas to predict the weather of a
particular area significantly enhances the prediction accuracy
rather than just looking at the area where the weather
forecasting is required.
Future work includes investigating the effect of adding
more weather variables such as wind speed, visibility, and
dew point on the prediction accuracy. Also, we suggest
experimenting with other types of DL architecture like CNN
to check if they can produce better results than RNN. In
addition to that, we suggest incorporating more locations
around the target location to improve the prediction
Fig. 10. The MSE values for five improvement experiments in predicting accuracy.
Amman’s weather conditions for the next 24 hours.
X. DISCUSSIONS REFERENCES
[1] O. Arabeyyat, N. Shatnawi, and M. Matouq, “Nonlinear Multivariate
The proposed model achieved very high prediction Rainfall Prediction in Jordan Using NARX-ANN Model with GIS
accuracy with a low MSE, 1.78×10-6. In fact, we cannot Techniques,” Jordan Journal of Civil Engineering, vol. 12, no. 3, pp.
compare our results with other works because other works 10, 2018.
don’t use that same dataset. To show the prediction accuracy [2] A. M. Dahamsheh and G. Suleiman, “Prediction of monthly rainfall in
of the proposed model, we took a random sample from the Jordan valley using artificial neural network,” International Journal of
Civil Engineering and Technology (IJCIET), vol. 11, no. 10, Nov
test set of Amman and made a prediction for it using the MI- 2020, doi: 10.34218/IJCIET.11.10.2020.004.
SO-2Ph model. The sample consists of the previous 120 [3] R. M. Schmidt, “Recurrent Neural Networks (RNNs): A gentle
hours of all-weather variables of the 16 locations as input Introduction and Overview.” arXiv, Nov. 23, 2019. Accessed: Nov
data, and the next 24 hours of Amman’s weather conditions 21, 2022. [Online]. Available: http://arxiv.org/abs/1912.05911.
as predicted output. Fig. 11 shows that the predicted values [4] L. O. Bani Khalid, “Forecasting the weather conditions in Jordan
using machine learning techniques,”, MSc. Thesis, Dept. of Comp.
of the 7 weather parameters closely match the actual values. Eng., Univ. of Jordan, Amman, Jordan, 2022.
[5] M. Akram and C. El-Amrani, “Sequence to Sequence Weather
Forecasting with Long Short-Term Memory Recurrent Neural
Networks,” IJCA, vol. 143, no. 11, pp. 7–11, Jun 2016, doi:
10.5120/ijca2016910497.
[6] K. U. Jaseena and B. C. Kovoor, “A hybrid wind speed forecasting
model using stacked autoencoder and LSTM,” Journal of Renewable
and Sustainable Energy, vol. 12, no. 2, pp. 023302, Mar 2020, doi:
10.1063/1.5139689.
[7] P. Hewage, M. Trovati, E. Pereira, and A. Behera, “Deep learning-
based effective fine-grained weather forecasting model,” Pattern Anal
Applic, vol. 24, no. 1, pp. 343–366, Feb 2021, doi: 10.1007/s10044-
020-00898-1.
[8] B. Zahran, A. Mesleh, M. Matouq, O. Al-Heyasat, and T. Alwada'n,
“Rainfall Prediction in Semi-Arid Regions in Jordan Using Back
Propagation Neural Networks,” International Journal on Engineering
Applications (I.R.E.A.), vol. 3, no. 6, 2015.
[9] I. Odeh, “Temperature Prediction in Jordan using ANN,”
International Journal of Computer Science and Information
Technologies, vol. 7, no. 1, pp. 378-383, 2016.
[10] M. I. Khan and R. Maity, “Hybrid Deep Learning Approach for
Multi-Step-Ahead Daily Rainfall Prediction Using GCM
Simulations,” IEEE Access, vol. 8, pp. 52774–52784, 2020, doi:
10.1109/ACCESS.2020.2980977.
[11] M. Chhetri, S. Kumar, P. Pratim Roy, and B.-G. Kim, “Deep
BLSTM-GRU Model for Monthly Rainfall Prediction: A Case Study
of Simtokha, Bhutan,” Remote Sensing, vol. 12, no. 19, pp. 3174, Sep
Figure 11. Actual versus predicted values of each weather parameter of a 2020, doi: 10.3390/rs12193174.
random sample using the MI-SO-2Ph model.
[12] G. A. Abandah, A. E. Suyyagh, and M. R. Abdel-Majeed, “Transfer
XI. CONCLUSION learning and multi-phase training for accurate diacritization of Arabic
poetry,” Journal of King Saud University - Computer and Information
In this work, a DL model based on ED-BiLSTM is Sciences, vol. 34, no. 6, pp. 3744–3757, Jun 2022, doi:
proposed for short-term weather forecasting in Jordan. The 10.1016/j.jksuci.2022.04.005.
proposed model achieves high accuracy in predicting the
weather conditions for 24 hours.
Authorized licensed use limited to: Princess Sumaya University for Technology. Downloaded on November 13,2024 at 09:51:24 UTC from IEEE Xplore. Restrictions apply.
115