My dataset is the result of multiple joins from large transactional database stored in a MySQL database. There are some columns with text value and double values. I am trying to do a first level sequential pattern mining on this dataset using SPMF.

  1. Is it possible to give words as input in SPMF? The documentation tells that only positive integers are allowed.
  2. If I want to give words or decimal numbers, which software/package shall I use?



2 Answers 2


Thanks for using SPMF. I'm the founder of that library. Currently, SPMF does not support text files containing some text as input. Thus, users need to do some preprocessing to convert the text file to the format used by SPMF. But in the future, it is my plan to add the feature of handling text files natively in SPMF. It will likely be added in the next few weeks, depending on my schedule.

By the way, if you have any question about SPMF, you can also directly ask them on the forum on the SPMF website. Then, I will answer you more quickly.


To complements @Phil's answers and the excellent SPMF Library:

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 20019.

Disclaimer: I am a member of the research collaboration between Fidelity & CMU on the Seq2Pat Library.


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.