Time Series Regression using a Neural Network Code in Python

I wrote an article titled “Neural Network Time Series Regression using Python” in the February 2018 issue of Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2018/02/02/neural-network-time-series.aspx.

In a time series egression problem, you have sequential numeric data, for example, monthly sales data for a year (12 data points) or two (24 data points). The goal of a time series regression problem is to predict the next value.

The difference between a regular regression problem and a time series regression problem is a bit subtle. In a regular regression problem, you have one or more predictor variables, and you want to predict a numeric value. But in time series regression, the implied predictor values are the previous numeric values in the sequence.

Time series regression problems are among the most challenging in all of machine learning. There are many different techniques you can use. In my article I show how to use a neural network to create a time series regression problem.

My demo program codes a neural network from scratch using the Python language. I like Python a lot, but I prefer C#, Java, and C/C++. But Python has clearly established itself as the dominant programming language for machine learning so all software engineers, including me, have to get on board with Python or be left behind.

My demo program uses the well known international airline passenger dataset. There are monthly passenger counts from January 1949 to December 1960 — 12 years, 144 data points. I used each set of four consecutive counts to predict the next count. This technique is called using a rolling window. The window size, such as the 4 I used, must be determined by trial and error.

In the graph below, I plot the actual data in yellow, and the predicted data in green. I ran out of space in my article, but I described how to extrapolate predictions into the future — shown in red on the graph.

Time series regression problems: easy-to-understand, but extremely difficult to solve.

Advertisements
This entry was posted in Machine Learning. Bookmark the permalink.