2
$\begingroup$

As stated in the question, I have a doubt about the possibility that K-Means would work if we apply it on one time series where each timestep is considered an individual data point. Please allow me to explain the problem as follows.

The dataset of interest comes are collected from sensor data. The dataset contains many multivariate time series, where one time series is denoted $T = \{ x_1, x_2, ..., x_N \}$ consisting of $N$ timesteps and of $P$ attributes. Domain experts tell us that there are 3 types of patterns that may be seen in any series. For example, in a series $T_i$ we can see the patterns $p_1$ and $p_2$, in another series $T_j$ we can see the patterns $p_1$ and $p_3$, etc. We want to extract these patterns, if any exists, from each time series.

Our team decided to run K-Means on each time series such that one timestep is seen as one data point. So the series $T$ becomes a matrix of $N$ rows and $P$ columns, each row is an individual data point. In other words, we've completely ignored the temporal dependence in the data.

Much to my surprise, K-Means has managed to find the patterns. The result is interpreted like this: a cluster label is assigned to each row in the matrix (i.e. that data point belongs to such cluster); consecutive data points that have the same cluster label form a pattern. Empirically, it works really well, the patterns are neatly found, but we're unable to provide any justification on why it works.

(Technically it's clear to us how K-Means finds/updates the centroids using Euclidean distance and so on but intuitively it isn't clear: why does it work on time series where one timestep = one data point??)

It really bugs me, being unable to understand why K-Means works but advanced algorithms that are dedicated to time series like motif discovery (using Matrix Profile for example) do not.

I'd appreciate it very much if anyone can provide some insights into this question.

Thank you very much in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$

Well, one reason that I see is that probably your patterns are almost completely described by the information contained in the points, and are not necessarily dependent on the temporal factor.

Imagine a very simple time series with univariate points, with a sinusoidal shape. If we want to recognize patterns as in "points below 0" and "points above 0", K-means can easily do so, as the information is already contained in the points themselves, and the temporal component can be ignored.
However, if we want to separate patterns as "decreasing" and "increasing", we cannot do so with an algorithm that ignores the time dependency, unless make our points multivariate including some feature on the lagged inputs (change from last point, or mean of the past days).

In your case, if K-means manages to fully discern your patterns, it would probably mean that these are fully described by the information that your sensors supply, and that they do not depend on their lagged values, or on their momentum.

$\endgroup$
2
  • $\begingroup$ Thanks for your reply! Hm in our case, we do have some kind of decreasing/increasing patterns. To be exact, what we define as a "pattern" is a set of univariate series that always vary the same way. For example, pattern p1 contains 3 univariate series s1, s2, s3 that all increase during a period of time, pattern p2 contains the same set of series but they all decrease. Maybe the reason why K-Means can find the patterns is that these series always vary in the same direction? $\endgroup$
    – Elise Le
    Commented Jul 16, 2020 at 7:27
  • $\begingroup$ No, that is not possible. Increasing/Decreasing cannot be picked up once you leave the temporal component out. One option is that the decreasing pattern of one of your univariate series happens simultaneously to some other univariate series having particularly high/low values. Imagine for example if you have a second series defining the derivative - then you would pick up the decreasing/increasing from the sign on this last one. Maybe in your case it is not as explicit, but there might be some correlation between some other series and the lagged values of your increasing/decreasing series. $\endgroup$
    – Davide ND
    Commented Jul 16, 2020 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.