## Abstract

Weather variations play a significant role in peoples’ short-term, medium-term or long-term planning. Therefore, understanding of weather patterns has become very important in decision making. Short-term weather forecasting (nowcasting) involves the prediction of weather over a short period of time; typically few hours. Different techniques have been proposed for short-term weather forecasting. Traditional techniques used for nowcasting are highly parametric, and hence complex. Recently, there has been a shift towards the use of artificial intelligence techniques for weather nowcasting. These include the use of machine learning techniques such as artificial neural networks. In this chapter, we report the use of deep learning techniques for weather nowcasting. Deep learning techniques were tested on meteorological data. Three deep learning techniques, namely multilayer perceptron, Elman recurrent neural networks and Jordan recurrent neural networks, were used in this work. Multilayer perceptron models achieved 91 and 75% accuracies for sunshine forecasting and precipitation forecasting respectively, Elman recurrent neural network models achieved accuracies of 96 and 97% for sunshine and precipitation forecasting respectively, while Jordan recurrent neural network models achieved accuracies of 97 and 97% for sunshine and precipitation nowcasting respectively. The results obtained underline the utility of using deep learning for weather nowcasting.

### Keywords

- nowcasting
- deep learning
- artificial neural network
- Elman network
- Jordan network
- precipitation
- rainfall

## 1. Introduction

Weather changes play a significant role in peoples’ short-term, medium-term or long-term planning. Therefore, the understanding weather patterns have become very important in decision making. This further raises the need for availability of tools for accurate prediction of weather. This need is even more pronounced if the prediction is intended for a short-term weather forecasting, conventionally known as nowcasting.

To date, different weather nowcasting models have been proposed [1]. These models are mainly based on the different variants of artificial neural networks and fuzzy logic. As will be discussed later in this chapter, these techniques have some limitations which need to be addressed. In this chapter, we report the use multilayer perceptron (MLP) neural networks, Elman neural networks (ENN) and Jordan neural networks for solar irradiance (sunshine) and precipitation (rainfall) nowcasting. The approach taken in this work is in line with the observation given in [1] in the sense that the performances of these models are further compared in order to establish which model performs best in weather nowcasting. The main contribution of the work reported in this chapter is the development of three solar irradiation and rainfall models using MLP, ENN and Jordan neural networks. These three models are examples of deep learning [2, 3, 4]. Therefore, the contribution of this work can be summarized as the use of deep learning models for weather nowcasting. Thus, the research question being addressed in this chapter is the design of integrated high-accuracy nowcasting techniques. Furthermore, the objectives of this work include:

The design of integrated high-accuracy nowcasting techniques using the following deep learning architectures:

MLP

ENN

Jordan recurrent neural networks

Application of such techniques to the following tasks:

sunshine nowcasting

precipitation nowcasting

The remainder of this chapter is divided as follows. The next section provides a background information on artificial neural networks and the related work on the use of artificial neural networks in weather nowcasting. This is followed by Section 3, which discusses the method used for the design and Implementation of both solar irradiation and rainfall nowcasting models. Results are provided and discussed in Section 4, while Section 5 concludes this chapter.

## 2. Preliminaries

### 2.1 Artificial neural networks (ANNs)

Artificial neural network (ANN) is an example of supervised machine learning [5, 6, 7]. It draws inspiration from how the biological neuron in the brain operates. Thus, it mimics natural intelligence in its learning from experience [5]. As a supervised learning algorithm, ANN learns from the examples by constructing an input-output mapping [8]. A typical ANN consists of an input layer, an output layer, and at least one hidden layer. Each layer consists of nodes representing neurons and is connected by weights. Each internal node of artificial neural network consists of two functions, namely transfer function and activation function [6, 7]. The transfer function is a function of inputs (x_{i}) and weights (w_{i}), and is given as

where b_{i} is a bias value. On the other hand, an activation function φ is nonlinear and hence responsible for modeling nonlinear relationships. Additionally, this function is differentiable [8]. The output of such an internal node is given as

Figure 1 shows a schematic diagram of a typical ANN. Each node in the figure represents a neuron, while the arrows represent the weights. The first layer is the input layer, and each node (neuron) of the input layer corresponds to the feature used for prediction. Thus, in Figure 1, there would be three features used for prediction. The hidden layer is between the input layer and the output layer. Its nodes take a set of weighted inputs defined by transfer function in Eq. (1), and produces the output given byEq. (2).

Depending on the number of hidden layers, artificial neural networks can be classified as either shallow neural networks or deep neural networks. In the former class (shallow neural networks), fewer hidden layers are used while on the latter (deep neural networks), several hidden layers are used for better prediction accuracy. Examples of deep neural network architectures include multilayer perceptrons, convolutional neural networks and recurrent neural networks [2, 4, 9]. It is worth noting that both Elman neural networks and Jordan neural networks are examples of recurrent neural networks [4, 10].

### 2.2 Related work: weather forecasting using ANNs

Different neural networks-based approaches to short-term weather forecasting have been proposed in literature [1, 10, 11]. furthermore, Mellit *et al.* [12] proposed artificial neural network model for predicting global solar radiation. The model proposed uses radial basis function networks, and uses sunshine duration and air temperature as inputs. The model used 300 data points for training, while 65 data points were used for validation and testing. The authors reported that the best performance was obtained with one hidden layer containing 9 neurons (nodes). In Ref. [13], authors reported adaptive neuro-fuzzy inference scheme (ANFIS)-based total solar radiation data forecasting model that takes as inputs daily sunshine duration and mean ambient temperature. The data used in the study spanned a period of 10 years; from 1981 to 1990. It reported validation mean relative error of 1% and correlation coefficient obtained from validation data set was reported to be 98%.

A solar radiation forecasting model based on meteorological data using artificial neural networks is reported in [8]. This algorithm uses meteorological data from Dezful city in Iran. Daily meteorological data from 2002 to 2005 is used to train the model, while 235 days’ data from 2006 is used as a testing data. The model takes as inputs length of the day, daily mean air temperature, humidity and sunshine hours. The model achieved absolute testing error of 8.84%. Additionally, Ruffing and Venayagamoorthy [14] proposed a short-to-medium range solar irradiance prediction model using echo state network (ESN). ESN is another variant of a recurrent neural network. The model reported in [14] is capable of predicting solar irradiance 30–270 minutes into the future. Correlation coefficient was used as a performance metric for the model. For 30 minutes ahead predictions, coefficient of correlation was obtained to be 0.87, while for 270 minutes ahead predictions, it decreased to 0.48. Finally, Hosssain *et al.* [15] reported the use of deep learning to forecast weather in Nevada. Their proposed model uses deep neural networks with stacked auto-encoders to predict air temperature using pressure, humidity, wind speed and temperature as inputs. Data used was collected in an hourly interval from November 2013 to December 2014. The model achieved accuracy of 97.94%.

Precipitation forecasting model using artificial neural networks was reported in [16]. This model is capable of estimating 6 hour rainfall over the south coast of Tasmania, Australia. The data used for this model consists of 1000 training examples, 300 validation examples and 300 test examples. The model obtained accuracy of 84%. On the other hand, Shi *et al.* [17] reported a model for precipitation nowcasting which uses convolutional long short term memory (LSTM) network. Unlike other models that were above, this model uses radio detection and ranging (RADAR) data instead of meteorological data. The model obtained a correlation coefficient of 0.908 and mean square error of 1.420.

As will be discussed in the next section, the abovementioned methods are limited compared to the method proposed in this chapter. One of the limitations is that the methods use fewer data instances than the one used in the method discussed in the next section. Another limitation is that the abovementioned techniques use fewer features (less than six features). Finally, unlike the technique discussed in the next section, which integrates different deep learning architectures for both sunshine nowcasting and precipitation nowcasting, the techniques mentioned above either use only one neural network architecture or are designed for one nowcasting task.

## 3. Methodology for design and implementation of weather nowcasting models

The forecasting models reported in this chapter are tested on hourly weather data from Lesotho for the period ranging from 01/01/2012 to 26/03/2012. This meteorological data consists of 2045 instances; and six features were used to make predictions. As opposed to the approaches discussed in Section 2.2 above, the method discussed in this chapter has two major advantages. The first one is that it uses more data; 2045 instances. Additionally, the method is feature-rich, since it uses six features (more than what other methods reported in Section 2.2 use) for short-term weather forecasting. As a means of feature engineering, all the predictors (features) were plotted against one another, in order to ensure that they are not linearly related, in which case it would be sufficient to use one instead of all those that are related. Therefore, these six features were selected because they proved to be independent predictors. These features are summarized in Figure 2. As can be observed from Figure 2, all the six features form the nodes of the input layers of all three deep learning architectures (namely, MLP, ENN and Jordan recurrent neural networks). Figure 3 summarizes the design of the method discussed in this chapter.

The models were developed using R statistical programming language [18, 19, 20], and RSNNS package was used to implement artificial neural networks [21]. The models created make use of multilayer perceptron, Elman recurrent neural network and Jordan recurrent neural network. These models were then used for weather Nowcasting to perform two tasks, namely sunshine predictions and precipitation predictions. Additionally, each model was designed with a time lag of 1 hour (thereby allowing 1 hour ahead forecasting). Furthermore, from the collected meteorological data, 80% of the data was used to train the model, 10% for validation, while the remaining 10% was used to test the model for accuracy. In order to enable reproducibility of the result, a seed was set to 2017 using the R command: “set.seed (2017).”

## 4. Results and discussion

Figures 4–6 show the MLP, Elman RNN and Jordan RNN sunshine forecasting models respectively. The black line is a fit for an ideal model, while a red line is a fit of the proposed model. As it can be observed, Jordan neural network model outperforms the other two models, while the multilayer perceptron model is the poorest of the three in sunshine nowcasting. Additionally, performances of both Elman neural network model and Jordan neural network model are comparable.

Figures 7–9 compare the performances of the three neural network models in precipitation nowcasting. Once again, the black line is a fit for an ideal model, while a red line is a fit of the proposed model. It can be observed that once again, MLP has the lowest performance while Jordan neural network model is the best-performing model. Also, the performances of both the Elman neural network model and Jordan neural network model are comparable.

Finally, accuracies of the models were compared, and the results are shown in Figure 10. The figure shows that MLP yet once again performing poorly compared to Elman RNN and Jordan RNN. Although these models have high accuracies individually, it is suggested that combining them together (as ensemble of models) might improve the accuracy even further. This possibility warrants further investigation.

## 5. Conclusion

In this chapter, we have reported the application of deep learning for short- term forecasting of Lesotho’s weather. The deep learning models used are multilayer perceptron, Elman recurrent neural networks and Jordan neural networks. These models were used to predict sunshine and precipitation. High accuracies of these models in weather forecasting underline their utility. Thus, high-accuracy results obtained from this work, coupled with the integrated nature of the technique reported, provide more advantages over other approaches used for weather nowcasting. Future work will focus on improving the accuracy of weather nowcasting by using an ensemble of the stated deep learning models, instead of using them as individual models.

## Acknowledgments

Makhamisa Senekane and Benedict Molibeli Taele acknowledge support from the National University of Lesotho Research and Conferences Committee. Mhlambululi Mafu thanks his colleagues at Botswana International University of Science and Technology for their unwavering support and constructive discussions.

## Conflict of interest

The authors declare no conflict of interest.