Pradnya1208 / Time-series-forecasting-using-Deep-Learning

The goal of this notebook is to implement and compare different approaches to predict item-level sales at different store locations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

github linkedin tableau twitter

Time series forecasting using Deep Learning

Overview:

Deep learning methods offer a lot of promise for time series forecasting, such as the automatic learning of temporal dependence and the automatic handling of temporal structures like trends and seasonality.

Dataset:

Predict Future Slaes
Store Item Demand Forecasting Challenge

Data Fields:

  • ID - an Id that represents a (Shop, Item) tuple within the test set
  • shop_id - unique identifier of a shop
  • item_id - unique identifier of a product
  • item_category_id - unique identifier of item category
  • item_cnt_day - number of products sold. You are predicting a monthly amount of this measure
  • item_price - current price of an item
  • date - date in format dd/mm/yyyy
  • date_block_num - a consecutive month number, used for convenience. January 2013 is 0, February 2013 is 1,..., October 2015 is 33
  • item_name - name of item
  • shop_name - name of shop
  • item_category_name - name of item category
  • store - Store ID
  • sales - Number of items sold at a particular store on a particular date.

Time period of dataset:

Min date from train set: 2013-01-01
Max date from train set: 2017-12-31

Implementation:

Libraries: NumPy pandas tensorflow matplotlib sklearn seaborn

Data Exploration:

Model training, evaluation, and prediction:

Multilayer Perceptron:

  • Multilayer Perceptron model or MLP model, here our model will have input features equal to the window size.
  • MLP models don't take the input as sequenced data, so for the model, it is just receiving inputs and don't treat them as sequenced data, that may be a problem since the model won't see the data with the sequence pattern that it has.

CNN Model:

  • For the CNN model we will use one convolutional hidden layer followed by a max pooling layer. The filter maps are then flattened before being interpreted by a Dense layer and outputting a prediction.
  • The convolutional layer should be able to identify patterns between the timesteps.

LSTM:

  • Now the LSTM model actually sees the input data as a sequence, so it's able to learn patterns from sequenced data (assuming it exists) better than the other ones, especially patterns from long sequences.

CNN-LSTM:

  • CNN-LSTM is a hybrid model for univariate time series forecasting.

  • The benefit of this model is that the model can support very long input sequences that can be read as blocks or subsequences by the CNN model, then pieced together by the LSTM model.

Comapring Models:


Model Train RMSE Validation RMSE
MLP 18.36 18.50
CNN 18.62 18.76
LSTM 19.98 18.76
CNN-LSTM 19.20 19.17

Lessons Learned

Time Series Forecasting Deep Learning for Time Series Forecasting LSTM

References:

Deep Learning for Time Series Forecasting

Feedback

If you have any feedback, please reach out at pradnyapatil671@gmail.com

🚀 About Me

Hi, I'm Pradnya! 👋

I am an AI Enthusiast and Data science & ML practitioner

github linkedin tableau twitter

About

The goal of this notebook is to implement and compare different approaches to predict item-level sales at different store locations.

License:MIT License


Languages

Language:Jupyter Notebook 100.0%