I am curious if sequential pattern mining algoritmhs fill a unique gap or the same thing can be achieved with alternative methods for example wih machine learning or something else. Do you know any alternative methodology that can achieve the same thing? (For me this would be relevant, because if there is an alternative method I can compare them in my thesis.)


1 Answer 1


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=[["A", "A", "B", "A", "D"],
                             ["C", "B", "A"],
                             ["C", "A", "C", "D"]])

# 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 <= price.average() <= 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 & CMU on the Seq2Pat Library.

  • $\begingroup$ Did you do any benchmarking or comparison to SPM algorithms (Apriori, SPADE, PrefixSpan, etc.)? $\endgroup$
    – inf3rno
    Commented Apr 8, 2021 at 16:43
  • 1
    $\begingroup$ Great question! There are some experiments on the Kosarak, MSNBC databases, and some other benchmarks in the AAAI 2019 paper. These benchmarks have 800K+ rows (sequences) with a maximum sequence length around 2K+ and ~30K. Some of the libraries in comparison does not support multiple attributes or the type of constraints, like average or median, that are available in Seq2Pat. The comparisons include the Prefix-Projection algorithm augmented with Constraint Checking and the PPCt algorithm from Aoga et.al. from Constraints'2018. For more details, AAAI 2019 paper might help. $\endgroup$
    – skadio
    Commented Apr 8, 2021 at 17:01
  • $\begingroup$ Thanks! I'll read the paper. Do you know of any other library that does something similar? $\endgroup$
    – inf3rno
    Commented Apr 8, 2021 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.