Is sequential pattern mining possible with machine learning?
Seq2Pat: Sequence-to-Pattern Generation Library might be relevant to your case.
The library is written in Cython to take advantage of a fast C++ backend with a high-level Python interface. It supports constraint-based frequent sequential pattern mining.
Here is an example that shows how to mine a sequence database while respecting an average constraint for the prices of the patterns found.
# Example to show how to find frequent sequential patterns
# from a given sequence database subject to constraints
from sequential.seq2pat import Seq2Pat, Attribute

# Seq2Pat over 3 sequences
seq2pat = Seq2Pat(sequences=[[&quot;A&quot;, &quot;A&quot;, &quot;B&quot;, &quot;A&quot;, &quot;D&quot;],
                             [&quot;C&quot;, &quot;B&quot;, &quot;A&quot;],
                             [&quot;C&quot;, &quot;A&quot;, &quot;C&quot;, &quot;D&quot;]])

# Price attribute corresponding to each item
price = Attribute(values=[[5, 5, 3, 8, 2],
                          [1, 3, 3],
                          [4, 5, 2, 1]])

# Average price constraint
seq2pat.add_constraint(3 &lt;= price.average() &lt;= 4)

# Patterns that occur at least twice (A-D)
patterns = seq2pat.get_patterns(min_frequency=2)

Notice that sequences can be of different lengths, and you can add/drop other Attributes and Constraints. The sequences can be any string, as in the example, or integers.
The underlying algorithm uses Multi-valued Decision Diagrams, and in particular, the state-of-the-art algorithm from AAAI 2019.
Another source that might be relevant is SPMF
Hope this helps!
Disclaimer: I am a member of the research collaboration between Fidelity &amp; CMU on the Seq2Pat Library.