# multi dimensional time series and matrix profile method

I have a time series of the following format:

time     product1     product2     product3     product4
t1       40           50           68           47
t2       55           60           70           100
t3       606          20           500          52
...

Values are sales. On day t1, how much money was spent on customers buying product1 for example.

I want to do time series clustering on this dataset. I am trying to use matrix profile distance. However, this method assumes only 1 dimensional data. Is there anyways to work around this?

In other words, you are trying to differentiate each product by extracting their sales dynamics in order to group which ones are similar and help taking strategic decisions?

First, you would need to define a good solution to recognize sales dynamics, or to dissociate them automatically. There are many potential solutions to that, but you have to keep in mind that if you are too precise in your data, sales fluctuations would not differentiate easily and the result would be no clusters at all.

That's why, you should remain realistic enough by simplifying your data to recognize patterns. Therefore you can use smoothing techniques like Pearson for instance.

Be careful because over simplification might not be useful: you have to find a good balance in order to have several clear and distinct clusters. It all depends on your business needs: Are you trying to find correlated sales at the same period, or do you want to find correlations with delayed patterns? Do you want to see clusters related to daily fluctuations, or weekly ones?

In all the cases, you will want to create several clustering views using different ranges of times and different degrees of simplifications.

Here are some tips to clusterize data using dimensional reduction algorithms: Can t-SNE be applied to visualize time series datasets

• For your first question: Yes. Why not Spearman smoothing? Spearman seems to fit the sales data better. Commented May 25, 2022 at 13:27
• I don’t know Spearman very well, but if you know it is better, you’re probably right: Pearson is a quite basic smoothing and many algorithms are better than it. I’ve had better results with kalman filters for instance. Commented May 25, 2022 at 14:52
• Have you come across matrix profile method before? I am trying to use, but it doesn't seem to support multi dimensional time series. It does so for motif discovery, but only does self joins based distance matrix. That is, it doesn't really compare time series, it just accepts multi series to treat them each on its own. Commented May 26, 2022 at 20:37