Weather Prediction through Sliding Window Algorithm and Deep Learning

Received: 29/Aug/ 2018, Accepted: 25/Oct/ 2018, Online: 31/Oct/2018 Abstract— There are currently many techniques present in the world to predict weather. However, none of them is sufficient in itself to accurately predict the weather on any given day, 100% of the time. At best what we have yet achieved is to come up with ways to reduce errors in current systems to make weather prediction more accurate. We, humans, have used satellite sensors to predict weather, we have used pattern recognition algorithms to predict future patterns in weather, but none is as accurate as we would like them to be. One such method to predict weather through pattern recognition is Sliding Window technique. This technique predicts weather through the data available to the system about previous year’s weather around that time. However, this technique is far from being even usable when it comes to efficiency, although it is a very fast method to predict weather and involve very less computations as compared to other techniques. Only if we can find a way to make this algorithm more efficient, that we can take advantage of its fast computational speeds to actually benefit from it. This paper presents a solution to greatly improve the efficiency of this method.


I. INTRODUCTION
We were motivated by studying sliding window algorithm in pattern recognition systems. We found the algorithm interesting, although it was, more often than not, too inaccurate to be practically used. We experimented in many ways to make this algorithm practically usable with respect to prediction accuracy. The solution that was successful in making the algorithm very efficient without compromising its low computations advantage was to add a neural network layer to the output of the sliding window output and make it learn its way to predict correct weather. The solution also makes some changes to the original solution to make it better suited for our neural network and then the hyper-parameters of the system are experimentally calculated to minimize prediction error. In this way we propose a new improved way of predicting weather which has the following advantages that no other present method offers: An efficiently accurate prediction of the weather though pattern recognition algorithm that is computationally cheap to execute. Section II contains our research work in this field on other techniques used around the globe to counter this problem. Our solution to the problem, along with the implementation details are discussed in Section III. In Section IV, we discuss the outcome of the solution and how much better it is as compared to the old system. In Section V, we discuss some methods to further improve upon this result.

II. RELATED WORK
II.1 SVM Support Vector Regression (SVR) is utilized to anticipate the greatest temperature at an area. It limits an upper limit on the error of generalization and the error in the training set isn't considered. So it performs superior to ordinary systems which may experience the ill effects of over fitting the data. SVM performs superior to anything MLP prepare with back propagation for all requests [1] . SVM has a noteworthy impact on the execution of the model. Through appropriate selection of the parameters, Support Vector Machines can be even better than a portion of the neural system based models for weather prediction applications. However, the drawback of such a system is that it is not very clear at times which parameter effects the SVM [2] , and hence it is hard to shortlist the deciding parameters, which effects its performance greatly.

II.2 ANN
Temperature is forecasted with the help of the neural network calculation which offers a wide variety of training algorithms. The algorithm mainly utilized in ANN is Back propagation Algorithm [3] . Pros of utilizing the BPN (I) it can genuinely estimate a substantial class of functionalities. (ii) More proficient than numerical separation. (iii) Has potential to catch the complex connections between numerous elements that affect certain temperature [4] . It approximates vast class of functionalities and indirect parameter with better exactness

II.3 Time Series Analysis
Time Series Analysis [5] catches the information patterns and information factors in predetermined time. Trial results come from using the proposed system and generalization limit of model [6] . The forecasting dependability is assessed by looking at the real and anticipated temperature values. The outcomes demonstrate that the system can be an essential tool for temperature prediction.

II.4 Fuzzy grouping
The utilization of heterogeneous information causes expanded uncertainty, where extensive load of information ought to be handled; this methodology is tedious and needs effective supercomputers. A viable technique is proposed in view of Fuzzy c-mean grouping and sort 2 fluffy rationale [7]. However, this technique is computation-heavy.

II.5 Naïve Bayes Data Mining for Weather Prediction
A machine learning approach for scientific weather prediction uses naïve bayesclassification [8] to find pattern and classify unstructured data into categories to get some useful information out of it. It is used to find patterns that previous data holds in weather changes to determine weather changes in the future [9] . It is quite an effective approach but is very complicated to implement and is CPU-extensive.

II.6 Sliding Window Algorithm for Weather Prediction
Sliding Window Algorithm is popularly used in computer vision in CNN applications and buffer implementation in computer networks. However it is shown that it can also produce great results when used as a pattern recognition algorithm [10] . Sliding Window Algorithm, hence, is also used to find pattern in previous years' weather data to predict weather in future [11] . However, this approach is the most inaccurate resultant of all the techniques mentioned in the survey. We tend to provide an efficient sliding window algorithm solution for weather prediction.

II.7 Diagnosis of Weather Forecasting
The demonstrative meteorology provides a way to understand the gap in accuracy amongst forecasting researchers and scientists. It is expected to give some establishment for indicative meteorology and it's anything but a weight from which the weather forecasters ought to be relieved [12] . Rather, it is a fundamental segment of scientific way of forecasting.

III. METHODOLOGY
The solution we propose in this paper is to combine the results coming out from sliding window approach to a neural network which learns to find the correct weights to which the output from sliding window computation must be multiplied and added to minimize error.

III.1 Forward Propogation
The system forward propagates to calculate the temperature, humidity and rainfall for the date. The layers in the feedforward network along with their functionalities are defined below: 2. The 30-day window's start and end date is decided by the 2 nd input to the system, the date whose weather is to be predicted. The date is entered in the form of DD/MM/YYYY.

III.1.2 Preprocessing
The preprocessing of input converts the user input into the input of the network system. The input to the network is 24 windows of 7 days prepared from the 30 day window. The network is fed the average temperature, rainfall and humidity values of all the seven days of a particular window for all the 24 windows.

III.1.3 Input to the network
After preprocessing, the network input is a structure array of 24 elements, each of which containing the average rainfall, temperature and humidity of that window.
Each structure element has 3 double variables to store the respective averages.

III.1.4 Sliding Window Implementation Layer
This layer has 3 nodes: SW1 -This node calculates the best suited window among the 24 window with respect to the temperature average of present date's preceding seven days. So the one window with the least absolute difference to the present day's preceding seven days' temperature average is the output of the SW1 node. In case of more than one node being the absolute best, the average of the parameters of all those nodes are given as output of the node.
The output temperature, humidity and rainfall of this layer is labeled as {T1, H1, R1}.
SW2 -This node calculates the best suited window among the 24 window with respect to the humidity average of present date's preceding seven days. So the one window with the least absolute difference to the present day's preceding seven days' humidity average is the output of the SW2 node. In case of more than one node being the absolute best, the average of the parameters of all those nodes are given as output of the node.
The output temperature, humidity and rainfall of this layer is labeled as {T2, H2, R2}.
SW3 -This node calculates the best suited window among the 24 window with respect to the rainfall average of present date's preceding seven days. So the one window with the least absolute difference to the present day's preceding seven days' rainfall average is the output of the SW3 node. In case of more than one node being the absolute best, the average of the parameters of all those nodes are given as output of the node.
The output temperature, humidity and rainfall of this layer is labeled as {T3, H3, R3}.

III.1.5 Neural Network Layer
This layer has 3 nodes NN1 -This node calculates the temperature output of the system by multiplying the temperatures from all the 3 Sliding Window Layer, i. e., T1, T2 and T3, and then add them to create the final output temperature.
NN2 -This node calculates the temperature output of the system by multiplying the humidity from all the 3 Sliding Window Layer, i. e., H1, H2 and H3, and then add them to create the final output humidity.
NN3 -This node calculates the temperature output of the system by multiplying the rainfall from all the 3 Sliding Window Layer, i. e., R1, R2 and R3, and then add them to create the final output rainfall.

III.1.6 Output Layer
This layer combines the temperature, humidity and rainfall calculations of neural network layer and display the final result to the user.

III.2 Back propagation
After the parameters are calculated through forward propagation in the network, it is compared to the actual value in the training set to adjust the weights in the neural network layer as to minimize the error.
To minimize the error, first we need to calculate the error in the system prediction. The loss function used to calculate the error for the system is: y= Actual Output This is known as the logits loss function. This is chosen in this case as it makes it easy to minimize the error as the function J(w,b) has only one minima in the whole function, rather than multiple local minima which makes it difficult to optimize the solution.

Fig. 2. Cost relation with respect to the training weights and bias
The weights in the neural network layer are then modified through the formula of gradient descent in back propagation.
The formula for the modification is: i= # node j= # weight of the node i This process repeats itself till the error is minimized and we have ourselves a pretty accurate system that predicts actual weather with the least possible error.

IV. RESULTS AND DISCUSSION
Here is the comparative analysis which showcases great improvement in the original method with the addition of our proposed solution:

V. CONCLUSION AND FUTURE SCOPE
Through these comparisons we conclude that adding a neural network into sliding window system greatly improves its efficiency.
The improvement in prediction of all 3 parameters is as follows:

II.
Increase the number of layers in the system, or add more training data to better train the system to increase its efficiency.