Seq2Pat: Sequence-to-Pattern Generation Library
Project description
Seq2Pat: Sequence-to-Pattern Generation Library
Seq2Pat (AAAI'22) is a research library for sequence-to-pattern generation to discover sequential patterns that occur frequently in large sequence databases. The library supports constraint-based reasoning to specify desired properties over patterns.
From an algorithmic perspective, the library takes advantage of multi-valued decision diagrams. It is based on the state-of-the-art approach for sequential pattern mining from Hosseininasab et. al. AAAI 2019.
From an implementation perspective, the library is written in Cython
that brings together the efficiency of a low-level C++ backend and
the expressiveness of a high-level Python public interface.
Seq2Pat is developed as a joint collaboration between Fidelity Investments and the Tepper School of Business at CMU. Documentation is available at fidelity.github.io/seq2pat.
Quick Start
# 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)
Available Constraints
The library offers various constraint types, including a number of non-monotone constraints.
- Average: This constraint specifies the average value of an attribute across all events in a pattern.
- Gap: This constraint specifies the difference between the attribute values of every two consecutive events in a pattern.
- Median: This constraint specifies the median value of an attribute across all events in a pattern.
- Span: This constraint specifies the difference between the maximum and the minimum value of an attribute across all events in a pattern.
Usage Examples
Examples on how to use the available constraints can be found in the Jupyter Notebook.
Installation
Seq2Pat can be installed from PyPI using pip install seq2pat. It can also be installed from source by following the instructions in
our documentation.
Requirements
The library requires Python 3.6+, the Cython package, and a C++ compiler.
See requirements.txt for dependencies.
Support
Please submit bug reports and feature requests as Issues.
License
Seq2Pat is licensed under the GNU GPL License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seq2pat-1.2.2.tar.gz.
File metadata
- Download URL: seq2pat-1.2.2.tar.gz
- Upload date:
- Size: 75.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53fe5e08277ea59ec20b5ed9e663fc54e4801b376a408ebe4e3a5ab1dca98d32
|
|
| MD5 |
8eaecfe876fb739c603218b6039ad9c9
|
|
| BLAKE2b-256 |
ed2f4eb643972224e85e45939d8f4ba64b6b9478c1dd544abfd0ea9129d18a0c
|
File details
Details for the file seq2pat-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl.
File metadata
- Download URL: seq2pat-1.2.2-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 134.3 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c08815c8c43d952ac447f30bf4ec233567eccc9c0c9d4c84e4c8ac664cac1c0
|
|
| MD5 |
318ca9447473d6d7cc2b99d76559a4c6
|
|
| BLAKE2b-256 |
39385ae4838385e63d688ad734057eb473d3e5d46b0f236e22f89647ba78792d
|