A Quick Deep Learning Recipe: Time Series Forecasting with Keras in Python
In this tutorial, we’ll discuss/compare three different ANNs(DNN, RNN and LTSM) on the same univariate dataset — advertising daily spend of an e-commerce company.
Table of Contents
- Introduction
- Time Series Analysis
- Why Deep Learning
- Process of conducting deep learning
3. Comparing Models
4. Closing Summary
1.1 Time Series Analysis
Details explained in my previous post here.
1.2 Why Deep Learning
We’ve known that statistical models work for forecasting time-series. However, there are some limitations for those methods:
- Need complete data for training. Some missing values can cause a very bad performing result on your model. Even though there are some ways to handle missing values but it’s very hard to
- Usually, deal with univariate dataset and it’s challenging to be applied on multivariate dataset
- Sensitive to missing values
Deep learning methods are able to deal with those challenges above:
- Not sensitive to missing value
- Ease of incorporating exogenous variables (apply on both univariate dataset and multivariate dataset)
- Captures non-linear feature interactions
- Automatic feature extraction
I’ll briefly explain key components/concept of neural network methods and show how to apply neural networks step by step with Keras in python code. For each model, I will follow the 5 steps to show how to use Keras to build a basic NNets to forecast time-series.
- Preprocessing
- Define neural network shape and Model Compilation
- Fit Model
- Evaluation
- Visualize prediction
First of all, takes a quick look at the dataset: Advertising daily spend from 1/1/17–9/23/19 includes 996 days. The first five rows of the dataset: