CS460-Machine Leraning-Project-Final Report

Goals



Time Series Methods(Midsem Work)

We Decided to use Time series models on the weather data of Janupur and make prediction on Temperature and Precipitation Values.

Models:

Auto Regression:

Uses past Values to make prediction. \[ y_{t}=\beta_{0}+\beta_{1} y_{t-1}+\varepsilon_{t} \longrightarrow \mathrm{AR}(1) \\ y_{t}=\beta_{0}+\beta_{1} y_{t-1}+\beta_{2} y_{t-2}+\varepsilon_{t} \longrightarrow \mathrm{AR}(2) \\ y_{t}=\beta_{0}+\beta_{1} y_{t-1}+\beta_{2} y_{t-2}+.......+\beta_{P} y_{t-P}+\varepsilon_{t} \longrightarrow \mathrm{AR}(P) \]

Moving-Average:

Uses past Error Values to make prediction. \[ y_{t}=\beta_{0}+\theta_{1} \varepsilon_{t-1}+\varepsilon_{t} \longrightarrow \mathrm{MA}(1)\\ y_{t}=\beta_{0}+\theta_{1} \varepsilon_{t-1}+\theta_{2} \varepsilon_{t-2}+\varepsilon_{t} \longrightarrow \mathrm{MA}(2)\\ y_{t}=\beta_{0}+\theta_{1} \varepsilon_{t-1}+\theta_{2} \varepsilon_{t-2}+...............+\theta_{Q} \varepsilon_{t-Q}+\varepsilon_{t} \longrightarrow \mathrm{MA}(Q)\\ \]

ARMA Model:

\( \\ \quad y_{t}=B_{0}+B_{1} y_{t-1}+...+B_{P} y_{t-P}+\theta_1 \varepsilon_{t-1}+.....+\theta_Q \varepsilon_{t-Q}+\varepsilon_{t} \longrightarrow ARMA(P,Q)\\ \) \(\varepsilon_{n}\) is the error in \(y_{n}\) prediction. \(\beta_i\) and \(\theta_j\) are coefficients. We have used ARIMA,SARIMA,SARIMAX models in the Prediction.The Detail can be found in midsem presentaion.

Finding parameters for model:

We have used ACF plots, PACF plots and AIC scores to set the model function and find p,q,d,P,D,Q and s values. We use ACF And PACF plots, which measure the correlation between current time period and previous time lags.

Review of Papers

Link to Midsem report.

Predictions:

Here are Plots of Temperature Prediction found from different models.Link to Midsem report.
Monthly Average Temperature Prediction using ARIMA(4,0,4)}: Trained for 450 months and Tested for next 30 months. It has a RMSE of 2.935 for Mean temp being 25.051 and AIC = 1878.252.
Monthly Average Temp Prediction SARIMA((2,0,2),(3,0,3,12)): Trained for 450 months and Tested for next 30 months. It has a RMSE of 1.820 for Mean temp being 25.051 and AIC = 1456.189
Monthly Average Temp Prediction SARIMAX (Surface Pressure)((2,0,2),(3,0,3,12))}:Trained for 450 months and Tested for next 30 months. It has a RMSE of 1.75 for Mean temp being 25.051 and AIC = 1450.676
Monthly Average Temp Prediction SARIMAX (Precipitation)((2,0,2),(3,0,3,12)) Trained for 450 months and Tested for next 30 months. It has a RMSE of 1.658 for Mean temp being 25.051 and AIC = 1405.498.
Time Series Based Models Worked Quite Well.Next, We wanted to try RNN Models for prediction.

RNN Model(Post Midsem)

Recurrent Neural Networks and why we choose it:

RNNs are the types of neural networks designed for capturing information from sequences or time series data.

Problems with ANN



In the above diagram, a chunk of neural network, A, looks at some input x_t and outputs a value h_t. A loop allows information to be passed from one step of the network to the next. A recurrent neural network can be thought of as multiple copies of the same network, each passing a message to a successor. Consider what happens if we unroll the loop:

This chain-like nature reveals that recurrent neural networks are intimately related to sequences and lists. They are the natural architecture of neural network to use for such data.


Types of RNNs:

RNNs are the types of neural networks designed for capturing information from sequences or time series data.



Problems in RNNs:


Vanishing gradient problem is more in case of timeseries prediction.


LSTM :The saver

Long Short Term Memory networks – usually just called “LSTMs” – are a special kind of RNN, capable of learning long-term dependencies. They were introduced by Hochreiter & Schmidhuber (1997).LSTMs are explicitly designed to avoid the long-term dependency problem. All recurrent neural networks have the form of a chain of repeating modules of neural network. In standard RNNs, this repeating module will have a very simple structure, such as a single tanh layer.

LSTMs also have this chain like structure, but the repeating module has a different structure. Instead of having a single neural network layer, there are four, interacting in a very special way.


Our Prediction Model

Monthly Average Temperature Prediction


Daily average Temperature Prediction


Summary of Results:

Monthly average Temperature Prediction
Sl.No Model Type Model Test score (RMSE)
1 ARIMA ARIMA(4,0,4) 2.935
2 SARIMA SARIMA(2,0,2)(3,0,3,12) 1.821
3 SARIMAX(PRECIPITATION) SARIMAX(2,0,2)(3,0,[1,2,3],12) 1.658
4 SARIMAX(SURFACE PRESSURE) SARIMAX(4,0,4)(3,0,[1,2,3],12) 1.756
5 SINGLE LSTM 1 DENSE LAYER 1.63
6 STACKED LSTM Two hidden layer(1 dense layer+1 LSTM layer) 1.47
7 Bi directional LSTM Bi directional LSTM 1.44
8 ConvLSTM ConvLSTM2D 1.51
Daily average Temperature Prediction
Sl.No Model Type Model Test score (RMSE)
1 ARIMA - very High
2 SARIMA - very high
3 SARIMAX(PRECIPITATION) - very high
4 SARIMAX(SURFACE PRESSURE) - very high
5 SINGLE LSTM 1 DENSE LAYER 1.09
6 STACKED LSTM Two hidden layer(1 dense layer+1 LSTM layer) 1.10
7 Bi directional LSTM Bi directional LSTM 1.10
8 ConvLSTM ConvLSTM2D 1.10