Keywords

1 Introduction

Rainfall prediction is a process of predicting the future rainfall values over a location with implementation of science and technology. Rainfall is a principle component in hydrological cycle and is a considerable source for both surface and ground water [1]. It affects many activities related to the field of agriculture, construction, electricity generation, etc., [2]. Agriculture is India's main practice that most of the Indian economy leans on agriculture [4, 15]. Here, rainfall plays a wide major role that early prediction of rainfall helps farmers to manage the crop yield sufficiently. This leads to a superior growth of economy in the country [5]. Many economists agree that a strong monsoon would be a swing factor giving Gross Domestic Product (GDP) number a one-time boost [8]. Also, the prediction of rainfall is very important to some degree that it is strongly associated with adverse events such as landslides, floods, and mass movements [6]. These uncertainties in the natural cycle are mitigated and eliminated only by getting the accurate rainfall prediction technique. Due to nonlinear behavior of rainfall, accurate prediction is more complex [9, 24]. The suitable method is to be adopted to solve this nonlinear relationship.

There are many techniques of various strategies available for the purpose of prediction. Statistical method requires broad historical climatic weather data [11] which is fairly used in predicting monsoon rainfall because the method fails in building nonlinear relationship. Dynamical method is based on the system of nonlinear governing equations [7] which are responsive to the initial conditions and makes them tougher to solve equations. Hence, dynamical method gives deficient results in long range predictions. Support vector machine (SVM) technique is used in supervised learning [13]. It provides better performance and unique solution [12]. However, it is not satisfactory for rainfall prediction because it achieves poor results. The multiple linear regression (MLR) technique is used to forecast the impacts of changes from one variable to another, but this is limited to linear relationship [3, 10]. The technique is easily affected by deviation of datasets; therefore, it is not fit to use for rainfall prediction. Concern to the study, there exist a nonlinear relationship between each elements; therefore, the nonlinear model or method like artificial neural network (ANN) can be best suitable for the present study.

Artificial neural network is a computational network, which includes several processing elements which secure inputs and supply outputs based on predefined activation function [13, 36, 38]. The most attractive feature of ANN is ability to learn the exact behavior between inputs and targets. Here, the network gets trained from collected historical datasets by training which is followed by validation and testing [14]. After successful training, the network is able to perform classification, prediction, etc., and captures complex relationship between input and target [19, 20]. ANN has several network types in which the present study uses back propagation neural network to predict the seasonal monthly rainfall in Mysuru taluk.

2 Back Propagation Neural Network

Back propagation neural network (BPNN) is an important type of artificial neural network. It is a feed forward network associated with back propagation algorithm. It is present with one input layer, one output layer, and one or more hidden layer (Fig. 1). It involves two passes, one is forward pass, and another is backward pass [23, 26]. In forward pass, the synaptic weights of neurons are fixed. In backward pass, the synaptic weights of neurons are adjusted in the network in accordance with error correction rule [29]. In this network, the number of hidden layer and the number of neurons in the hidden layer get selected depending upon input and target features [31, 33]. BPNN has wider applications in the field of prediction; therefore, the present study preferred this network for rainfall prediction.

Fig. 1
figure 1

Back propagation neural network

3 Methodology

Following are the steps taken up in the present work:

  1. 1.

    Study area and data used

  2. 2.

    Arrangement and normalization of datasets

  3. 3.

    Generating rainfall prediction networks using BPNN

  4. 4.

    Training the created networks

  5. 5.

    Performance analysis

  6. 6.

    Conclusions.

3.1 Study Area and Data Used

The study area selected for the work is Mysuru taluk which is present in southern part of Karnataka state in India. Agriculture is the cornerstone of this area’s economy, the rivers Kaveri and Kabini provide irrigation needs to it. Here, the temperature ranges from 15 ℃ (in winter) to 35 ℃ (in summer) and gets 785 mm of average annual rainfall. The prediction of rainfall in this region helps in sufficient management of crop yield and water resources.

The data used for the present work were relative humidity, temperature, wind speed, and rainfall. These were collected from Karnataka State Natural Disaster Monitoring System (KSNDMC) Web site. The Web site proactively included all the relevant information that will be easy to understand and open to the public. The data has been collected for Mysuru over an eight-year period from 2012 to 2019, and it is in Excel format.

3.2 Arrangement and Normalization of Datasets

The collected datasets are not in the order that required for the present work, and these should be arranged before moving it into the MATLAB workspace. At first, the datasets were grouped to input and target datasets. Parameters taken for the input datasets were relative humidity, atmospheric temperature, and wind speed where rainfall has taken for target datasets. Then, these input and target datasets were arranged in the form of matrix, i.e., [m * n]. Here, ‘m’ represents rows which in turn refers to parameters and ‘n’ represents column which in turn refers to number of collected historical data. The research considers only average seasonal month’s data (June, July, August, and September) from past eight years. Thus, the total number of data used for the study is ‘Thirty-two’. Then, the corresponding arranged input and target datasets were in the form of [3 * 32] and [1 * 32], respectively.

The arranged datasets should be normalized before they hit model input. Normalization is a process of rescaling one or more attributes to the value ranges from 0 to 1 [22, 28, 39]. Usually, this process is used for datasets having different SI units. In this study, parameters present in the datasets have their own SI units and are different from each other. The direct use of these datasets causes an error in the output results of network and also affects network efficiency. Thus, the datasets needs to be normalized which enhances the network by reducing total error and increasing overall efficiency. In this present study, the normalization process has been done using (Eq. 1).

$$ {\text{Normalized value = }}\frac{{\left( {X_{{\text{a}}} - X_{{{\text{min}}}} } \right)}}{{\left( {X_{{{\text{max}}}} - X_{{{\text{min}}}} } \right)}} $$
(1)

where

Xa = actual data to be normalized in the datasets.

Xmax = maximum value in the datasets of respected parameter.

Xmin = minimum value in the datasets of respected parameter.

Then, the normalized values were taken into MATLAB workspace where research has been carried out using nntool by generating rainfall prediction networks using BPNN.

3.3 Generating Rainfall Prediction Network Using BPNN

In the present study, the rainfall prediction networks were created using back propagation neural network. It is a type of artificial neural network which is developed based on the mechanism of biological brain. Here, the construction of network has been done using neural network toolbox of MATLAB. The ‘nntool’ has been used because it facilitates the development of more general neural network. At first, the normalized input and target datasets were imported to MATLAB workspace. Then, nntool is opened and specified the features that it has. In this work, as shown in Fig. 2, the feed forward back propagation network type is selected with Training function ‘TRAINLM’, adaption learning function ‘LEARNGDM’, performance function ‘MSE’, and transfer function ‘TANSIG’. All these specifications are done based on the trial work that carried using sample datasets. Here, three inputs and one target feature were used which is sufficient to use single hidden layer; therefore, the number of layers considered is two, one is hidden, and another is output layer.

Fig. 2
figure 2

Network creating window

Then, the hidden layer should specify the number of neurons (N). The change in the number of neurons influences the network performance and leads to achieve better results at some particular N value. Therefore, the present work performed by creating ten different BPN rainfall prediction networks with change in neuron value, i.e., N = 2, 4, 6, 8, 10, 12, 14, 16, 18, and 20. These created networks get stored in the data manager or nntool window as shown in Fig. 3.

Fig. 3
figure 3

Neural network window with created networks

3.4 Training the Created Networks

Training the created rainfall prediction network is very important in BPNN. The overall performance of this network depends on this training process. Training should be done effectively for this network because a well-trained network leads to achieve good results [32, 34]. Here, the process of training that carried in the initial network ‘Network_N_2’ was presented where the process is same for all other created networks.

Figure 4 shows the initial network that has created using BPNN with number of neurons in the hidden layer is ‘2’. One can verify the created network pattern using ‘view’ ribbon in the network window. Then, click on ‘Train’ ribbon which opens training info as shown in Fig. 5. Here, the inputs and targets were assigned using imported input and target data from MATLAB workspace. After this, click on ‘Train Network’ to train the Network_N_2 which has done more than 50 times here to achieve good training.

Fig. 4
figure 4

Rainfall prediction network (Network_N_2)

Fig. 5
figure 5

Training info window

Then, the network should also perform the same training process by changing training parameters because network training by changing training parameters gets influence over network accuracy.

Click on training parameters. It involves show, epochs, time, goal, min_grad, max_fail, mu, etc., as shown in Fig. 6. However, present study concentrates on the change of epochs and max_fail because both of these represent iterations in the network. Iterations are very important here for network training because an increase in iterations leads to reach higher accuracy in the network results. Therefore, the present study has been performed the training for default settings of training parameters and by changing the epoch and max_fail to 100, 500, 1000, and 1500.

Fig. 6
figure 6

Training parameters window

After the completion of training process, simulation has done for the network. Click on ‘Simulate’ ribbon in the network window which opens simulation data as shown in Fig. 7. Here, the inputs and targets were specified again using input and target data. If require, the output and error name can be changed here. After this, click on ‘Simulate Network’ to simulate the network outputs and corresponding errors. This simulated output and error results get stored automatically in the respective output and error data box of data manager window as shown in Fig. 8. These output and error results were exported to MATLAB workspace using ‘Export’ option.

Fig. 7
figure 7

Simulate window

Fig. 8
figure 8

Neural network window with network outputs and errors

4 Results and discussions

In this present study, the performances of ten different BPN networks were analyzed through their respective regression (R) value at higher iteration. R is defined as correlation coefficient which is used to measure the relationship between any two variables [17]. Here, correlation coefficient ‘R’ is used to measure the strong relationship between output and target of the networks. In this, output represents the results obtained from the rainfall prediction network as a network output and target represents the datasets that given to the network to reach as a network target.

Based on the observation from Table 1, a good relationship can be seen in between the network N = 10 and N = 16. Here, among ten rainfall prediction BPN networks, the network at N =  12 achieved higher correlation, i.e. R = 0.941. A good relationship in the network promotes good results in the prediction; therefore, output results of the network N = 12 were taken for the performance analysis in detail. The analysis has been done using regression results and simulated results.

Table 1 Regression value for ten different rainfall prediction networks

4.1 Regression Results

The regression results of this network include plots of all the three stages that involved in the network which are training, validation, and testing.

  1. 1.

    Training stage

The training stage is the initial and more presiding stage where further stages are dependent on this [21]. Generally, the whole datasets that used in the work are divided into training datasets, validation datasets, and testing datasets. Usually, more than 50% of total datasets are used for training the network. The remaining datasets are equally divided for validation and testing [30].

In this study ‘Nntool’ has been used where the tool has default settings in datasets distribution for training, validation, and testing stage, i.e., 60% of total datasets are distributed for training, 20% for validation, and remaining 20% for testing. However, the particular study has 8 years monthly average datasets where 60% of datasets utilized the first 4 years of data for training purpose. The corresponding result of this was presented below.

Figure 9 shows the regression plot of training stage. Here, the training process achieved correlation coefficient of 0.937 between output and target. Here, output represents the results obtained from the network at training level, and target represents the datasets that given to the network to reach as a network target. For any artificial neural network, training is the main priority. A good relationship in the training process leads to an increase of network efficiency. In this study, the network achieved a good relationship between output and target which indicates that the network is well trained in its sequence.

Fig. 9
figure 9

Regression plot of training stage

Then, the output values were calculated for the training stage using the output equation that is available in the regression plot of training stage. The calculated output values were in the normalized form where these values should be de-normalized.

De-normalization is the method of storing the join of superior normal form relations as base relation [35, 40]. It is very important to de-normalize the output values in this study because the prediction has to be made in the normal form of SI units. Therefore, the de-normalization has been performed in this work for the output values using (Eq. 2).

$$ {\text{De - normalized value = }}\left( {{\text{Normalized value}} \times {\text{ }}\left( {{\text{Max}}\left( X \right) - {\text{Min}}\left( X \right)} \right){\text{ + Min}}\left( X \right)} \right) $$
(2)

where

X’ refers to a specific parameter that considered for de-normalization.

Max(X) = maximum value in the datasets of specified parameter.

Min(X) = minimum value in the datasets of specified parameter.

Then, comparison graph was plotted between the de-normalized output and target rainfall values for training stage. From the comparison graph (Fig. 10), it is observed that the output and target rainfall values are very similar to each other. A small difference is observed between them. Here, the results of regression plot and comparison graph conclude that the training stage achieved good results with better accuracy, and the network is suitable for prediction activity.

Fig. 10
figure 10

Comparison graph for training stage

  1. 2.

    Validation stage

The training process is followed by validation process. Here, the learned model has been validated using validation datasets. The process improves the network if any variance occurs in it. In the present study, the validation process utilized next two years of data for validating the trained network. The corresponding result of this were shown below.

Figure 11 shows the regression plot of validation stage. Here, the network achieved good correlation between output and target, i.e., R = 0.979. Then, the output values were calculated using the output equation that available in the regression plot of validation stage.

Fig. 11
figure 11

Regression plot of validation stage

The calculated output values were de-normalized using (Eq. 2). Then, comparison graph was plotted between the de-normalized output and target rainfall values for validation stage. From the comparison graph (Fig. 12), it is observed that the output and target rainfall values are similar to each other with small difference. Here, the results of regression plot and comparison graph conclude that the validation stage achieved good results with better accuracy, and the network is validated in its sequence.

Fig. 12
figure 12

Comparison graph for validation stage

  1. 3.

    Testing stage

The validation process is followed by testing process. Here, the validated network has been tested using testing datasets. The testing process describes the network capability of handling the datasets [18, 37]. The present work utilized the last two years of datasets to test the validated network, and the corresponding results were presented below.

Figure 13 shows the regression plot of testing stage. Here, the network achieved good correlation between output and target, i.e., R = 0.971. It indicates that the network is highly correlated and tested in its sequence and attained better accuracy. Then, the output values were calculated using output equation that available in the regression plot of testing stage. The calculated output values were de-normalized using (Eq. 2).

Fig. 13
figure 13

Regression plot of testing stage

Then, comparison graph was plotted between the de-normalized output and target rainfall values for testing stage. From the comparison graph (Fig. 14), it is observed that the output and target rainfall values are not highly similar to each other which indicate that the network should be improved in this process.

Fig. 14
figure 14

Comparison graph for testing stage

Thus, from the demonstration of all the three process, the network with N = 12 supports to carry the action of rainfall prediction using its simulation results.

4.2 Simulation Results

The simulation results were obtained directly from the network. The analysis of this result has been made in the platform of Microsoft Excel. At first, simulated values were de-normalized using (Eq. 2), and then, de-normalized output and target rainfall values were compared by plotting the comparison graph. Along with the comparison graph, the linear graph was also plotted to analyze the simulated results.

Figure 15 shows the comparison graph for simulated result of rainfall prediction network N = 12. From comparison graph, it is observed that very similarities in the output and target rainfall values with some small difference (in between). It indicates that the network achieved good results with better performance.

Fig. 15
figure 15

Comparison graph for simulated result of N = 12

From linear graph (Fig. 16), the value of R2 and corresponding linear equation were obtained. Here, the R2 represents the coefficient of determination. It is an output of regression analysis. R2 is interpreted as the portion of the variance in the dependent variable that is predictable from the independent variable. Also, it is the square of correlation (R) between output and target values; thus, it ranges from 0 to 1 [16, 25, 27]. Here, if R2 is near to zero or lower value indicates that the dependent variable cannot be predicted from the independent variable. If R2 is higher or near to one indicates that the dependent variable can be predicted from the independent variable. In this present work, the R2 reached the value of 0.885 which is somewhat good value indicates a good relationship between output and target rainfall values in the overall network. Therefore, the linear equation obtained from this linear graph is best suitable for the prediction of future rainfall values.

Fig. 16
figure 16

Linear graph for simulated result of N = 12

4.3 Prediction Results

In this study, the back propagation neural network achieved its best result in the network N = 12. Therefore, the result of that network has been used for the prediction of future rainfall values. However, the prediction has been made using linear equation obtained from the linear graph (Fig. 16). The linear equation obtained was Y = 0.8931 * X + 11.761. Here, ‘X’ uses the average of monthly seasonal average rainfall values to predict the upcoming average monthly rainfall values for seasonal months. Then, the prediction of rainfall values in ‘mm’ has made for the Mysuru taluk and they are 92, 90, 119 and 116 (June, July, August and September) respectively.

5 Conclusions

The created rainfall prediction networks using BPNN were performed individually and achieved good results. Among ten different networks, the higher regression relationship and good fit were observed in the network ‘N = 12’. The network also achieved good results with high accuracy in the process of prediction. The predicted rainfall values in ‘mm’ are 92, 90, 119, and 116 (June, July, August, and September), respectively. In this study, BPNN proved as a good technique for rainfall prediction. Here, data used is not sufficient for long range prediction. The prediction accuracy can be increased further by considering larger historical datasets.