Skip to content
Machine Learning with Time Series data
Jupyter Notebook
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
images Initial commit Aug 30, 2019
look-into-the-data.ipynb Initial commit Aug 30, 2019
prophet.ipynb Initial commit Aug 30, 2019

Tutorial: Machine Learning with Time Series

Round of applause to Andrii Gakhov and his video tutorials!

Instructor: Vaibhav Srivastav


Time series is an important instrument to model, analyze and predict data collected over time. In this talk, we learn the basic theoretical concepts without going deep into mathematical aspects, study different models, and try them in practice using StatsModels, Prophet, scikit-learn, and keras.

Required Software

Attendees will need to bring a laptop with scikit-learn and pandas (and their dependencies) already installed. Installing the Anaconda distribution of Python is an easy way to accomplish this. Both Python 2 and 3 are welcome.

I will be leading the tutorial using the IPython/Jupyter notebook, and have added a pre-written notebook to this repository. I have also created a Python script that is identical to the notebook, which you can use in the Python environment of your choice.


Nowadays, it is hard to find a company that doesn’t collect various time-dependent data in different forms, for instance, it can be a daily number of visitors and monthly sales for online stores, available resources and stock for factories, number of food poisoning cases for hospitals, and so on. And the reason why all that data is carefully collected, because it can provide meaningful insides not only about the past but can be used to predict and prepare for the future.

In this presentation, we discuss how to analyze and forecast those data, that is called time series. Many people already did that many times while trying to predict the weather on the weekend, guessing the currency exchange rate for tomorrow, or just by expecting great discounts on Christmas sales. Of course, some patterns are truly obvious, like weekly or monthly changes, and overall tendency, others are not. However, all these aspects can be formalized and learned automatically using the power of mathematics and computer science.

The first part is dedicated to the theoretical introduction of time series, where listeners can learn or refresh in memory the essential aspects of time series’ representations, modeling, and forecasting. In the second part, we dive into the most popular time series forecast models - stochastic models (e.g., Autoregressive integrated moving average (ARIMA)), artificial neural networks (e.g., seasonal recurrent neural network) and Support Vector Machines (SVR). Along the way, we show at practice how these models can be applied to a real-world dataset of UK visits by providing examples using such popular Python libraries as StatsModels, Prophet, scikit-learn, and keras.

With these guidelines in mind, you should be better equipped to deal with time series in your everyday work and opt-in for the right tools to analyze them.

GitHub repository:

Prerequisite Knowledge

Attendees to this tutorial should be comfortable working in Python, should understand the basic principles of machine learning, and should have at least basic experience with both pandas and scikit-learn. However, no knowledge of advanced mathematics is required.


To demonstrate the mentioned in the presentation models, I will use the following dataset:

OS visits to UK (All visits)

The dataset represents the monthly total number of visits to the UK by overseas residents (in thousands)
from January 1980 to October 2017. Source: Office for National Statistics

Stochastic Models

As a stochastic model for seasonal time series, in the presentation, I describe the Seasonal Autoregressive Integrated Moving Average (SARIMA) model.

Another example is Facebook Prophet model that implements an additive regression model which is essentially a sophisticated curve-fitting model.


Read More

Seasonal ARIMA with Python

TimeSeries Decomposition in Python with statsmodels and Pandas

How to Make Out-of-Sample Forecasts with ARIMA in Python

Introduction to ARIMA: nonseasonal models

[book] Time Series by A.W. van der Vaart

[github] Time series predictions with Keras

Time Series Prediction with LSTM Recurrent Neural Networks in Python with Keras

[book] Time series analysis by Jan Grandell

Seasonal Decomposition of Time Series by Loess

How To Identify Patterns in Time Series Data: Time Series Analysis

[paper] Another look at measures of forecast accuracy

[book] An Introductory Study on Time Series Modeling and Forecasting

[paper] PSO based Neural Networks vs. Traditional Statistical Models for Seasonal Time Series Forecasting

[paper] Seasonal Time Series Forecasting Models based on Artificial Neural Network

[paper] Improving artificial neural networks’ performance in seasonal time series forecasting

Forecasting strong seasonal time series with artificial neural networks

Recurrent Neural Networks. Part 1: Theory

[slides] Time Series Analysis - Moving average and ARMA processes

How to Make Out-of-Sample Forecasts with ARIMA in Python

Cryptocurrency Predictions with ARIMA

Using Facebook Prophet Forecasting Library to Predict the Weather

Forecasting Time-Series data with Prophet

Prophet: forecasting at scale

Playing with Prophet on Bike Sharing Demand in Washington, D.C.

[paper] Using support vector machines for time series prediction

You can’t perform that action at this time.