1 Introduction

Our aim is to evaluate whether a machine can detect a recurring sequential pattern within a univariate time series (i.e., a single vector of observations that are temporally ordered). The time series we are working with are univariate – they look just like a long vector of numbers. The observations could reflect continuous measurement of air temperature, pupil size, heart rate, reaction time, etc. Most of these data are autocorrelated – i.e., where you are today predicts where you will be tomorrow.

2 Simulating a noisy time series, signals embedded

We’ll start by simulating some data in which there exists a repeating pattern such as a specific number sequence. Here it’s 1-10 repeated 10 times. We’ll call that signal1. We’ll also create a different number pattern (21,22,23,24,25,24, 23,22,21) repeated 10x and call that signal2. Each of these signals constitute their own unique little pattern or motif. Time series researchers call these snippets ‘subsequences’. A motif is a special case of a repeating subsequence. For example, we might expect to see a few years of cooling temperatures with a gradual return to baseline in the air temperature after a giant volcano explodes. This motif is a meaningful pattern nested within climate time series.

What’s a signal withut noise? Let’s embed our two motifs into a noise distribution. We’ll create this by randomly sampling integers 1-40 with replacement (200 observations) then combine signal1, signal2, and noise into a single vector. Convert that to a time series object, and plot it.

3 Check for motifs

We have reached the critical point where we need to see if an agnostic (unsupervised) machine learning algoirthm can detect and extract the two motifs we embedded in there (signal1 and signal2) using univariate motif detection. We won’t tell it what to look for (that’s the unsupervised part), but we know the ground truth in advance. It needs to detect two motifs….and so it does.