# Approach for unsupervised time series clustering/segmentation

I have a big sample of data on a human's everyday life. The snapshots of the life are taken every 5 minutes. The data include time, the location of the human, accelerometer data, gyroscope data, and others.

The data are unlabeled and I know that there have to be 5 main clusters: "sleeping", "eating", "exercising", and "working"...

Before I made assumptions, e.g., "if human's location is x and if the accelerometer value is y and gyroscope value is z, duration is k, then human is sleeping". I know this may create issues as sometimes there may be a different label for those precise values. Therefore, I thought of using time-series clustering for my problem.

How do I approach it? Or am I complicating the solution and I should simply use my "if var1 value = x, var2 value = x2, then the label is N"?

As I mentioned, the data are not labeled, but I know there should be 5 labels.

I appreciate your help to put me on track.

I would recommend a dimensional reduction algorithm such as t-SNE or UMAP, in order to visualize the different clusters in an unsupervised way.

This is quite easy to do, as long as you normalize the data first in the case of t-SNE.

%matplotlib inline
import pandas as pd
from sklearn.manifold import TSNE

import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap

dataset = your_dataset

#(here you normalize each column with their max)

tsne = TSNE(n_components=2, n_iter=5000, random_state=3)
points = tsne.fit_transform(your_dataset[features])
plt.scatter(points[:, 0], points[:, 1])


Once you have detected the ranges of values from each cluster, you should be able to define which is sleeping, running, etc.

• Thank you for the comment. What if I also care about the duration of the event? Let's say if it looks like the human is sleeping, but the duration was only 5 min, I know that is false (I assume there were no 5 min naps). Jun 29, 2022 at 6:59