Python implementation of ITPMiner algorithm


Keywords
itpminer
License
MIT
Install
pip install itpminer==0.0.12

Documentation

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