GSP (Generalized Sequence Pattern) algorithm in Python
Project description
GSP-Py
Generalized Sequence Pattern (GSP) algorithm in Python
This package was created to use GSP with Python
Table of Contents
Requirements
Install Python:
sudo apt install python3
Installation
To download GSP-Py just clone the Git repository hosted in GitHub:
git clone https://github.com/jacksonpradolima/gsp-py.git
python setup.py install
Alternatively, you can install it with pip
:
pip install gsppy
Usage
Examples of configuring and running are located in the test folders gsppy folder.
To use it in a project, import it and use the GSP class.
from gsppy.gsp import GSP
It is assumed that your transactions are a sequence of sequences representing items in baskets.
transactions = [
['Bread', 'Milk'],
['Bread', 'Diaper', 'Beer', 'Eggs'],
['Milk', 'Diaper', 'Beer', 'Coke'],
['Bread', 'Milk', 'Diaper', 'Beer'],
['Bread', 'Milk', 'Diaper', 'Coke']
]
Init the class to prepare the transactions and to find patterns in baskets that occur over the support threshold (count):
result = GSP(transactions).search(0.3)
The support count (or simply support) for a sequence is defined as the fraction of total data-sequences that "contain" this sequence. (Although the word "contains" is not strictly accurate once we incorporate taxonomies, it captures the spirt of when a data-sequence contributes to the support of a sequential pattern.)
License
This project is licensed under the terms of the MIT - see the LICENSE file for details.
Citation
If this package contributes to a project which leads to a scientific publication, I would appreciate a citation.
@misc{pradolima_gsppy,
author = {Prado Lima, Jackson Antonio do},
title = {{GSP-Py - Generalized Sequence Pattern algorithm in Python}},
month = jul,
year = 2019,
doi = {10.5281/zenodo.3333988},
url = {https://doi.org/10.5281/zenodo.3333988}
}
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
File details
Details for the file gsppy-1.1.tar.gz
.
File metadata
- Download URL: gsppy-1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb7f8fe979b5890518b97ed094c4de0ca4381ec6a5ce738ea57593c3e88f9b6 |
|
MD5 | f4737c5d337ab84972c7f53a9622d645 |
|
BLAKE2b-256 | 46825ff6c7ff0a8fadee00ceab2d8029ceb570827a3971c7e8e925e279ca781c |
File details
Details for the file gsppy-1.1-py3-none-any.whl
.
File metadata
- Download URL: gsppy-1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc952456374943267fae5ce4a76c585fce411c5105e51c4d4089e55a36b5ec56 |
|
MD5 | bc1ca1bff3369a1732031892687157e5 |
|
BLAKE2b-256 | 9e56f95ca67afeac96244b6b005eac91d44c5f717e807dc0a82ba96b6668fc95 |