Time series forecasting with machine learning
So far, we have examined statistical methods with reasonable success. Now, we will proceed with modeling time series data using deep learning techniques. We will begin with mastering how to set up a window dataset. We will also cover ideas such as shuffling and batching, and see how we can build and train a neural network for our sales forecasting problem. Let’s begin by mastering how we can prepare time series data for modeling using the windowed dataset method with the aid of TensorFlow utilities:
- We begin by importing the libraries required:
import tensorflow as tf
import numpy as np
Here, we will be using NumPy and TensorFlow to prepare and manipulate our data into the required structure for modeling.
- Let us create a simple dataset. Here, we are assuming the data consists of temperature values for two weeks:
# Create an array of temperatures for 2 weeks
temperature = np.arange(1, 15)
print(temperature)
When we print out...