Predicting Common Movement

Timur Bakibayev, Ph.D.
Analytics Vidhya
Published in
5 min readAug 25, 2020

--

With Linear Regression

Motivation

It is surprising how much fun one can have with linear regression.

This is the work of my master’s student. She has implemented this simple prediction algorithm to learn the basics of Machine Learning and Linear (Poly) Regression.

This article describes an algorithm for geographical coordinates processing using polynomial regression to calculate the common behavior of a movement. The primary advantage of this algorithm is having a map of trajectories in any region. We have used Python programming language together with scikit-learn and matplotlib libraries for machine learning and visualization. In the end, we try to predict several steps of the movement of all objects on the map.

Main Idea

Most of the studies for trajectories clustering handle moving objects separately. We do the same for preprocessing, but in the end, we come up with the split data for smaller parts of trajectories that would be feed to a machine learning model.

During data preprocessing we convert single points into tiny lines that represent trajectories, where the length of the line corresponds to the object’s speed. Next, we add extra columns for building polynomials.

We are given coordinates of each object at each time moment, so the input table looks as follows:

  1. Object id
  2. Time (integer field, autoincrement)

--

--