<p>I will mention 3 &quot;levels&quot; at which you could solve this problem, assuming that you will be able to frame your problem statement accordingly. Please consider this answer as something you can use to get direction on how to solve this problem since the question you ask is not that specific and covers a very wide scope (usually against SO guidelines).</p>
<hr />
<p><strong>Traditional approaches</strong> involved using some DR (Dimensionality reduction) approaches such as PCA followed by Clustering such as Kmeans, Gaussian mixtures, Density-based methods, etc.</p>
<p><a href="https://i.stack.imgur.com/nxt6q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nxt6q.png" alt="enter image description here" /></a></p>
<p>The issue with these approaches was that they assumed that <em>the observed data was generated from a lower-dimensional latent space via simple linear transformations</em>. E.g. When using PCA on data, you assume that the data that you see comes from linear combinations of the 2 principal components. This works for a lot of datasets but more complex data is usually a result of non-linear transformations of lower-dimensional latent spaces.</p>
<hr />
<p><strong>More modern approaches</strong> handled this to some extent using DNNs as pre-processing followed by clustering methods. DNNs helped with the non-linearity as well as allowing for better low dimensional representations for data types such as sequences and images. This is usually what the majority of the baseline benchmark models are made on -</p>
<ol>
<li>Train an auto-encoder to regenerate the sequence</li>
<li>Take the bottleneck embedding/latent vector and use a clustering algorithm to cluster in this latent space.</li>
</ol>
<p><a href="https://i.stack.imgur.com/E6asN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E6asN.jpg" alt="enter image description here" /></a></p>
<p>While these approaches work well, there is a flaw in these as well. Since no clustering-driven objective is explicitly incorporated in the learning process, <em>the learned DNNs do not necessarily output low dimensional data that are suitable for clustering</em>.</p>
<hr />
<p><strong>The latest research</strong> involves training DNNs along with a clustering loss so that it ensures that the latent space is clustering friendly. These algorithms give superior results to any of the above approaches. One of the SOTA approaches in this category is <a href="https://arxiv.org/pdf/1610.04794v1.pdf" rel="nofollow noreferrer">DCN (Deep clustering networks)</a>. DCNs combine the reconstruction loss of an autoencoder with a clustering loss. It defines a centroid-based target probability distribution (very similar to Kmeans but with student-t distribution) and minimizes its KL divergence against the model clustering result.</p>
<p><a href="https://i.stack.imgur.com/6U7Wr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6U7Wr.png" alt="enter image description here" /></a></p>
<p>Find more information <a href="https://deepnotes.io/deep-clustering" rel="nofollow noreferrer">here</a> and <a href="https://www.dlology.com/blog/how-to-do-unsupervised-clustering-with-keras/" rel="nofollow noreferrer">here</a>.</p>
<hr />
<p><strong>Specific to your case:</strong> You have a sequence vector with 4 features. You can build an LSTM based autoencoder to create initial embeddings and then use a clustering method to cluster the latent vector. Or if you are interested in DCNs, you can build a similar setup with an autoencoder and then use the clustering loss along with reconstruction loss to further train the encoder to generate clustering-friendly embeddings.</p>
How to cluster sequences?
<p>How you would cluster sequential information? I have about 500 sequences and some have the same characteristics. Is there anything like K-means for categorical sequential (temporal) data, or what would your approach look like?</p>
<p>These sequences are sequences of one-hot-encoded vectors which are representing classes. Consider for example the nurse-rostering problem with four classes: early-shift, day-shift, night-shift, home. The vectors look like this: [0, 1, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], this nurse works 2 days with the day-shift and is home the third day. But this &quot;schedule&quot; could depend on the parameters of the hospital, so I would like to cluster similar data. I have about 500 &quot;schedules&quot;. Any ideas?</p>