# AI in Weather Forecasting

Weather forecasting is the application A.I. used to predict the change in the atmosphere for a given area, location and time. Since, 19th century people have tested to predict the weather condition. Weather forecasting is made by collecting the quantitative data about the current condition of the atmosphere at a given place and to show how the atmosphere will change.

Now a days A.I. is an increasingly important tool on weather prediction , with a boost from increasingly powerful high performance computer and massive data ,scientists are beginning to apply A.I to create forecast that are accurate.

# What is A.I.?

Artificial intelligence (A.I.) is a branch of computer science which is know with a smart machines capable of performing tasks that requires human intelligence. AI is an interdisciplinary science with multiple approaches , but advancement in machine learning and deep learning are creating a vast spread in every sector of the tech industry.

# HOW DOES ARTIFICIAL INTELLIGENCE WORK?

AI is the branch of computer science that gives the answer of Turing’s question in the affirmative. It is the endeavor to simulate the human intelligence in machines.

The vast expansive of artificial intelligence has given rise to many questions . As so, that there is no singular definition is universally accepted.

The major limitation in AI defining as simply “building machines that are intelligent” is that it doesn’t actually explain what artificial intelligence is? or What makes a machine intelligent?

There are four different approaches that defines the field of AI:

1. Thinking humanly

2. Thinking rationally

3. Acting humanly

4. Acting rationally

To predict the weather from the data , we need to make data suitable to the input of the mathematical model. This processed data is then stored in the data warehouse. This stored data can be directly taken as an input to the mathematical model which eventually give us the information.

The process of converting this raw data into the cleaned data is known as Knowledge Discovery Process . In other words we’ve known as Data Mining.

To predict the information there are various methods of Data Mining is used such as :

1.Decision Tree (ID3)

2.Neural Networks

3.Naive Bayes

4.Sliding windows

5.Bayesian Belief Network

6.Support Vector Machine

so , we are going to explain one of the algorithm which is Sliding Window Algorithm for weather forecasting.

**Sliding Window Algorithm**

The work proposes to predict a day’s weather conditions. From the previous seven days weather is taken into consideration along with weather conditions of past years.

Suppose we need to predict weather of 23rd December 2020 then we will take into consideration the weather conditions of 16th Demcember 2020 to 22nd December 2020 along with the weather conditions prevailing in the span of 16th December to 29th December in past years.

Then the day by day variation in the current year is computed. The variation is also being computed from the fortnight data of previous year. In this work the four major weather parameters that is, maximum temperature, minimum temperature, Humidity and Rainfall which will be taken into consideration.

Hence the variation size of the current year will be represented by matrix of size 7×4. And similarly for past year the matrix size would be 14 × 4.

Now, the first step is to divide the matrix of size 14×4 into the sliding windows. Hence, 8 sliding windows can be of size 7×4 each.

Now ,the next step is we have to compare every window with the current year variation. The best-match window is then selected for making the prediction. So here we use Euclidean distance approach for the purpose of matching. The reason for taking Euclidean distance is that it has the power to represent similarity in spite of its simplicity.

Following are the parameters which is used for the weather condition prediction :

(1) mean: The mean of day’s weather conditions, that is maximum temperature, minimum temperature, humidity, and rainfall. After adding each parameter separately and divide by total number of days

Mean (M)= Sum of parameters / number of days

(2) variation: It is calculate day by day variation after taking difference of each parameter. This tells how the next day’s Weather is related to previous day’s weather after calculating the variance.

(3) euclidean distance: It compares data variation of current year and previous year.

By this we are able to mathematically model defined dependencies. That the relationship between previous year and previous week data is being defined mathematically to know the future weather condition . This can be used to predict the future conditions.

# Algorithm

Step 1. Take a matrix “CD” of last seven days for current year’s data of size 7×4.

Step 2. Take a matrix “PD” of fourteen days for previous year’s data of size 14 × 4.

Step 3. Make 8 sliding windows of size 7×4 each from the matrix “PD” as 𝑊1, 𝑊2, 𝑊3,…,8

Step 4. Compute Euclidean distance of each of the sliding window with the matrix “CD” as ED1, ED2, ED3,…, ED8

Step 5. Select a matrix

𝑊𝑖 as 𝑊𝑖 = Correponding Matrix (Min.(ED𝑖)) ∀𝑖 ∈ [1, 8]

Step 6. For 𝑘 = 1 to 𝑛 (i) .

For the WC𝑘 compute the variation vector for the matrix “CD” of size 6×1 as “VC”.

(ii) For the WC𝑘 compute the variation vector for the matrix “PD” of size 6×1 as “VP”.

(iii) Mean1 = Mean (VC) .

(iv) Mean2 = Mean (VP) (v) Predicted Variation (𝑉) = (Mean1 + Mean2)/2

(vi) Add “𝑉” to the previous day’s weather condition in consideration to get the predicted condition.

Step 7. End

The sliding window used for predicting the “𝑛” number of weather conditions which is (WC1, WC2, WC3,…, WC𝑛) is shown in Algorithm 1.

The main logic behind using the sliding window approach is that ,the current weather conditions at some span of day in the year might not have existed in the same span of days in previous year. For instance the weather condition in first week of February 2021 might not have existed in the first week of February in 2020.

The similar weather conditions might have existing in previous year but not necessarily in same week but in some days. The probability of finding the same weather conditions are maximum at the considered fortnight spam.

**Result**

The algorithm has been executed and tested in Matlab 2020a version. Thus, in the algorithm in consideration from the previous year’s data is being utilized for predicting the weather conditions. Hence, the algorithm is tested to predict weather condition for three years, that is, 2008–2010, which is being tested against the available data. Also it can be concluded that the learning approach is used in the algorithm . In the test four weather conditions are taken into consideration, that is, minimum temperature, maximum temperature, humidity and rainfall. Temperature, in general it can be measured to a higher degree of accuracy relative to any of the other weather variables. The data of these four factors are taken from day wise for the previously mentioned four years. The algorithm is also being tested day wise. These graphs clearly shows that the least variation among the actual and the predicted weather conditions. The month wise accuracy of predicted weather conditions is being given in TABLE 1.

The above result of the weather conditions have been from an Indian cities. India has a typically tropical type of weather, that is the weather which has all the varieties. The Champawat city lies in the state of the Uttaranchal which lies in the planes of Ganges. The month wise accuracy in Table 1 it can be understood by the following facts. The months of April, May, and June are considered to be of summers which are correspond to high temperature. The months of November, December, and January are winters having very low or cold temperature conditions.

Thus, the factors like temperature are quite fixed in these months and hence the accuracy for these is also very high. In contrast the months like February, March, August, and September are considered to be the months when the weather get changes, that is the phase of transition from one season to another season. In the months of February and March, the winter season is shifted to summer from Feburary to march. And in the month of August and September, the summer is getting over and, winter starts coming.

And hence the weather condition becoming highly unpredictable in these months. Also it is observed that the weather conditions is greatly vary in these months from years to years. This is also being seen in the results.

**Conclusion and Future Work**

The comparison of the weather condition variation using the sliding window approach which has been found to be highly accurate except for the months of seasonal change where conditions are highly unpredictable. The results can be reversed or altered by changing the size of the window. Accuracy of the unpredictable months can be increased by increasing the window size one month. Since ANN techniques are very good in mapping Inputs and outputs and the sliding window algorithm is incorporated with ANN could improve the results drastically even for the months of seasonal change.

Thank you !

Authors : Kalyani Vidhate, Astitva Ghanmode, Omkar Dalwai, Kartik Tiwari, Swati Chim

**References:**

2] https://builtin.com/artificial-intelligence

3] https://en.wikipedia.org/wiki/Artificial_intelligence

4] https://www.analyticsinsight.net/ai-empowering-weather-forecasting-technology/

5] https://levelup.gitconnected.com/an-introduction-to-sliding-window-algorithms-5533c4fe1cc7