Grouping Similar Sequences I have extracted a ton of log data from a mobile application. The objective of this task is to identify similar patterns of behavior.
Which algorithm should I look at which will group behaviors together.  I have structured the data in a similar way to the below: 
 Customer ID    Time    Session
 Bob            10:15   A,B,E
 Mary           10:16   E,B,C
 Bob            10:45   A,B,E
 Sue            10:08   B,E
 Bob            10:51   A,B,E
 Mary           10:50   C
 Bob            11:05   A,B,E

Basically, the app will log you out after 5 mins so I grouped all the transactions into 5 min sessions. The session describes the behavior of what happened in 5 mins, and each letter describes an event the user triggered. So I am trying to find similar behaviors of customers using a sequence of events. I need to use python as my implementation language. 
 A: This is a sequence of categorical events. In order to compare and cluster (group) them we need some similarity metric(s).
One approach would be to treat the sequence as a text string, and use one of the many existing string similarity metrics, such as: Levenstein Distance, cosine similarity, Jaccard index, et.c. The Python package textdistance provides a unified interface to over 30 of these algorithms, including some sequence-based like Longest Common Subsequence.
You would then use (some) of these metrics as features. Probably should standardize them as their ranges may be quite different.
Feature selection using correlation or mutual information might be useful to reduce the number of features, as there may be redundancies. Or using a feature reduction technique like PCA or UMAP.
The Tensorflow embedding projector can be used to explore the data when mapped down to a 2/3-dimensional space.
An alternative, or complimentary approach, would be to use a learned sequence embedding. One Python library for that would be sgt.
