Registry / analytics / prefixspan

prefixspan

JSON →
library0.5.2pypypi✓ verified 86d ago

PrefixSpan is a Python 3 library for sequential pattern mining, implementing PrefixSpan, BIDE, and FEAT algorithms. Current version is 0.5.2, with infrequent releases.

pip install prefixspan
INSTALL
IMPORT
SIG · PREFIXSPAN
P
prefixspan
analyticspythonv0.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PrefixSpan
from prefixspan import PrefixSpan
from prefixspan import prefixspan
Class name is case-sensitive; wrong casing causes ImportError.

Basic example: finding top-5 frequent sequential patterns.

from prefixspan import PrefixSpan db = [ [1, 2, 3, 4], [1, 2, 4], [1, 3, 4], [2, 3, 4], ] ps = PrefixSpan(db) patterns = ps.topk(5) print(patterns) # [(4, 4), (2, 3), (3, 3), (4, 3), (1, 3)]
Debug
Known issues
deprecatedThe 'minlen' parameter in PrefixSpan methods is deprecated. Use 'min_len' instead.
fix
Replace minlen=2 with min_len=2.
affects: >=0.5.0
breakingThe result format changed in version 0.5.0: patterns are now sorted by support descending, then by pattern length, then lexicographically.
fix
If you relied on a specific order, sort results explicitly.
affects: >=0.5.0
gotchaThe library expects sequences as lists of integers (or hashable items). Strings may cause unexpected behavior if not consistent.
fix
Ensure all items in sequences are the same type and hashable.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'PrefixSpan' from 'prefixspan'
Wrong import: using lowercase 'prefixspan' instead of 'PrefixSpan'.
fix
Use: from prefixspan import PrefixSpan
ValueError: minlen is deprecated, use min_len
Using the deprecated 'minlen' parameter.
fix
Change to min_len parameter.
TypeError: unhashable type: 'list'
Items in sequences are lists instead of hashable elements.
fix
Convert inner lists to tuples or use hashable items.
Upgrade
Version history
0.5.2latest on PyPI · released Sep 29, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
30
Amazon
1
OpenAI (training)
1
Resources
prefixspan — pip install prefixspan · libregistry