Skip to main content

Python implementation of ITPMiner algorithm

Project description

Inter-Transactional Patterns Miner(itpminer)

image image Open In Colab image

Python implementation of ITPMiner algorithm[1]

  • Free software: MIT license

Features

  • Mine frequent inter-transactional items
  • Generate association rules between inter-transactional items
  • Generate a network graph of association rules
  • Type definitions provided for mypy type checker

Installation

PIP:

pip install itpminer

Conda:

conda install -c conda-forge itpminer

Example

See also demo.ipynb or Colab Notebook. The code below is available on demo.py.

# Import itpminer and create a dummy database of inter transactions
from itpminer.utils import association_rules, rules_graph
from itpminer import itp_miner

database = [
    ["a", "b"],
    ["a", "c", "d"],
    ["a"],
    ["a", "b", "c", "d"],
    ["a", "b", "d"],
    ["a", "d"]
]

# Mine frequent inter-transactional patterns
tree_dict, frequent_patterns_dict, frequent_patterns_list, frequent_patterns_dataframe = itp_miner(
    database=database)

frequent_patterns_dataframe

# Derive association rules from frequent patterns
rules_dict, rules_display_dict, rules_dataframe = association_rules(
    tree_dict=tree_dict)

rules_dataframe

# Plot a network graph between extended items
rules_graph(rules_display_dict=rules_display_dict, rules_dict=rules_dict)

rules_graph

Credits

This package was created with Cookiecutter and the giswqs/pypackage project template.

References

[1] Anthony J.T. Lee, Chun-Sheng Wang, An efficient algorithm for mining frequent inter-transaction patterns, Information Sciences, Volume 177, Issue 17, 2007, Pages 3453-3476, ISSN 0020-0255, https://doi.org/10.1016/j.ins.2007.03.007. (https://www.sciencedirect.com/science/article/pii/S002002550700151X) Keywords: Association rules; Data mining; Inter-transaction patterns

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itpminer-0.0.12.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

itpminer-0.0.12-py2.py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page