Time series Shapelets in 10 minutes

Hi all,
While I was working on my Final Year Project, I went through this amazing concept, “Time Series Shapelets”. After struggeling with shapelets for hours, considered of sharing that on my blog 🙂

Overview

Classification of time series has been a very interested field over many years. Most common methof of analyzing time series has been nearest neighbour algorithm. The problem with that approach is, it requires soring and searching the entire dataset, resulting in a time and space complexity that limits it’s applicability, especially on resource-limited sensors. Time series shapelets addresses these issues and you can get a very deep understanding by going through this research paper

Shapelets in 10 minutes

You may think now, “How are we going to learn shapelets in 10 minutes, research paper is too long?” okay don’t worry 🙂 Let’s start like this.

  • Urtica dioica and Verbena urticifoli are two leaves from two classes. You can see it’s very hard to identify the different between these two classes.  When it comes to this kind of problems, time Shapelets can be used. 

Samples of leaves from two species. Note that several leaves have the insect-bite damage

  • After converting each leaf into a one dimensional representation, it looks like the following. So you can clearly identify the different by analyzing shape of the representation.

A shape can be converted into a one dimensional “time series” representation. The reason for the highlighted section of the time series will be made apparent shortly

  • It is proven that using a nearest neighbor classifier with either the (rotation invariant) Euclidean distance or Dynamic Time Warping (DTW) distance does not significantly outperform random guessing.

Sample JAVA code (https://github.com/ArtisanHub/Shapelet-Learner.git)

Since this is a huge area, I just wanted to give a small idea about Shapelets. Though you can find a lot of articles on Shapelets, it’s a bit difficult to find a working implementation of Time Series Shapelets. So I thought of sharing a sample code with you guys. Please refer this github link and get familiar with the implementation. First you might find, the sample code is a bit difficult to understand. That’s because it’s the first time 😛

Feel free to comment bellow if you have any questions.

References :- L. Ye and E. Keogh, “Time series shapelets,” pp. 947–956, Jun. 2009. [Online]. Available: http://dl.acm.org/citation.cfm?id=1557122. 

Leave a Reply