Skip to main content

Sequence-mining

Description

This package implements SPAM algorithm described in the paper Sequential PAttern Mining using A Bitmap Representation by Jay Ayres, Johannes Gehrke, Tomi Yiu, and Jason Flannick.

This package mostly translates a SPAM implementation written in Java by Philippe Fournier-Viger, which can be found in the next repository spmf. For more information about spmf implementation, please, read the Web page Mining Frequent Sequential Patterns Using The CM-SPAM Algorithm

Installation

pip3 install sequence-mining

Usage

from sequence_mining.spam import SpamAlgo

# Input: List[List[List[int]]] or Sequences [ Sequence [Transaction[ids] ]]
# ids in a transaction are expected to be lexicographically sorted
sequences = [
    [[0, 2, 10, 13, 14, 15, 18, 20], [2, 7, 12, 15, 17, 19], [6, 12, 19], [0, 3, 4, 6, 15], [1, 3, 10, 13, 15],
     [8, 10], [4, 8, 9, 10]],
    [[9, 10, 17], [4], [0, 1, 2, 3, 4, 5, 12, 13, 19], [0, 1, 5, 10, 17, 18], [4, 7, 12], [2, 8, 9, 13, 15, 16, 19],
     [3, 5, 6, 9, 11, 13, 18, 19], [2, 5, 9, 10, 13, 16, 20], [2, 3, 6]],
    [[0, 9, 10, 13, 14, 19, 20], [0, 1, 9, 15, 17], [1, 7, 11, 12, 15, 20], [7, 9, 10, 11, 14, 18], [0, 10],
     [5, 13, 15], [1, 5, 9, 15], [1, 5, 7, 8, 19], [2, 6, 11, 14, 16], [3, 10, 11, 12]],
    [[15], [6, 9, 10, 12, 13, 15, 16], [13, 16]]
]

algo = SpamAlgo(0.7)
algo.spam(sequences)
# print mined sequences
print(algo.frequent_items)

Release files for sequence-mining 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sequence-mining 0.0.3
File Size Uploaded
sequence_mining-0.0.3.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sequence-mining 0.0.3
File Interpreter ABI Platform
sequence_mining-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / sequence_mining-0.0.3.tar.gz

Download URL sequence_mining-0.0.3.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
aef3bed4dc44dfdac064671d56b1241e741e64271368ec4563ad33b635cd48ca
BLAKE2b-256 checksum
How to use checksums
2fb0d1051d60f34505938a84f5fe56e623af13cb696d843de3493c2a6426f14c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / sequence_mining-0.0.3-py3-none-any.whl

Download URL sequence_mining-0.0.3-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba24bbeeca971ebc20df0ac545c9a5f4a6d0e8e9c70d2cd07a53d23977664c5a
BLAKE2b-256 checksum
How to use checksums
f523006bae822d844e94f9fa488389f5718c252ec71ec1fb9b5ecf27ebfe1f31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page