ICP_12 - Girees737/KDM_Projects GitHub Wiki

Description About the ICP:

This ICP is all about the implementation of the basic LSTM (Long Short-Term Memory network) model for time series data.

Objective:

The main objective of this assignment is to implement an LSTM model with a time series dataset and find the accuracy of it & predict the future information based on the present data.

Design Implementation:

Initially, Imported all the required libraries to build the model.

  1. For this task, We have considered the Airline passengers series data. Forcasting the number of passengers next month using the number of passengers (in units of thousands) of current month.

  1. The below plot shows the data of the number of passengers with respect to the time on x-axis.

  2. LSTMs are sensitive to the scale of the input data, specifically when the sigmoid (default) or tanh activation functions are used. It can be a good practice to rescale the data to the range of 0-to-1, also called normalizing. We can easily normalize the dataset using the MinMaxScaler preprocessing class from the scikit-learn library.

  1. In the next step, splitted the whole data into 2 parts i.e Training and Testing data.

  1. Defined a simple function to convert our single column of data into a two-column dataset: the first column containing this month’s (t) passenger count and the second column containing next month’s (t+1) passenger count, to be predicted.

  1. Built a simple LSTM model on training data. The LSTM architecture here consists of a. One input layer b. Two LSTM layer of 4 blocks c. Dropout values d. One Dense layer to produce a single output e. Use MSE as loss function

  1. Summary() function will give the information about the model.

  1. Started training the model by calling model.fit() method. We could see that accuracy on the training set and validation set at each epoch.

  1. Predicted the results on test data with the model and observed that the RMSE on test data set is 104.60 as below.

  1. Plotted the time series graph which has both train set and predicted test set values on y-axis and months on x-axis.

Video Link: https://youtu.be/8WBoRjrhAfg

Conclusion:

In this ICP, I have learned how LSTM's can be build and the same can be sued for sequence predictions like time series data. Also learned the difference between RNN's and LSTM's and their application.

Also I have understood how we can prepare the time series data for training the Long short term memory(LSTM's) models