17
$\begingroup$

Has anyone used (and liked) any good "frequent sequence mining" packages in Python other than the FPM in MLLib? I am looking for a stable package, preferable stilled maintained by people. Thank you!

$\endgroup$
6
$\begingroup$

The only Python package I've found is on Github.

They have an implementation of BIDE there, but it's not maintained code.

$\endgroup$
  • $\begingroup$ Just to clarify, it did not implement BIDE which mines frequent closed sequences. It actually implemented PrefixSpan which mines all frequent sequences. PrefixSpan and BIDE share the same pattern enumeration framework, and that is why the authors cited the BIDE paper. $\endgroup$ – Chuancong Gao Apr 20 '18 at 21:44
  • $\begingroup$ What I did in the end is used: philippe-fournier-viger.com/spmf - It's a JAVA lib but I've wrapped it with python to match my needs $\endgroup$ – yossico Jun 26 '18 at 19:14
6
$\begingroup$

I am actively maintaining an efficient implementation of both PrefixSpan and BIDE in Python 3, supporting mining both frequent and top-k (closed) sequential patterns.

$\endgroup$
  • $\begingroup$ I'd like to implement those in javascript, but I don't fully understand how these algorithms work. Can you explain it in plain English? $\endgroup$ – inf3rno May 25 '18 at 10:51
  • $\begingroup$ I suggest you check my original minimal implementation of PrefixSpan. Its core part takes only 15 lines. gist.github.com/chuanconggao/4df9c1b06fa7f3ed854d5d96e2ae499f $\endgroup$ – Chuancong Gao May 28 '18 at 5:18
  • $\begingroup$ Thanks! I'll try to translate it to js, but won't be easy. :-) Afaik PrefixSpan is building projected databases based on where the prefix matches. I am currently reading about BIDE, which is theory is an even better algorithm. $\endgroup$ – inf3rno May 28 '18 at 10:45
  • $\begingroup$ There are too many differences between js and python collections. I did not manage to reproduce the code in js. I'll try it again later. $\endgroup$ – inf3rno May 28 '18 at 11:39
  • $\begingroup$ Not sure whether it helps, but I have another Scala version of PrefixSpan. github.com/chuanconggao/PrefixSpan-scala However, I highly suggest you fully understand the algorithm before implement. $\endgroup$ – Chuancong Gao May 28 '18 at 11:51
2
$\begingroup$

Have you considered to write it by yourself? Because there is probably no up-to-date maintained library right now.

Check this out, its the basic - PrefixSpan and Closed/Maximal patterns are actually not that hard to implement.

$\endgroup$
1
$\begingroup$

I've used fim's fpgrowth function in the past and it worked well. It's kind of a pain to install on Windows machines however. It seems to be an academic website so I'm not sure if they're doing many updates to the code over time...

$\endgroup$
1
$\begingroup$

SPMF sounds like a useful library for pattern mining.

$\endgroup$
0
$\begingroup$

Since none of the existing solutions were satisfactory for me, I created my own Python Wrapper for SPMF (the Java library mentioned in other answers here).

$\endgroup$

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