Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 683 Bytes

File metadata and controls

41 lines (31 loc) · 683 Bytes

prefixspan

C++20 implementation of PrefixSpan pattern mining algorithm.

Quick Start

#include <prefixspan.hxx>
#include <vector>

namespace ps = prefixspan;
using vec = std::vector;

int main() {
  vec<vec<int>> sequences {
    {0, 1, 2},
    {0, 2, 2},
    {0, 1, 1},
  };

  ps::prefixspan<int> pattern_tree(sequences, minsup=2); 
}

Python Bindings

pip install git+https://github.com/bolu61/prefixspan@main#subdirectory=bindings/python
from prefixspan import prefixspan
sequences = [
  [0, 1, 2],
  [0, 2, 2],
  [0, 1, 1],
]

pattern_tree = prefixspan(sequences, minsup=2)
assert repr(pattern_tree) == '<prefixspan 0,1,;2,;;1,;2,;>'