<jupyter_start><jupyter_text>Running in Colab
You can run this notebook in Google Colab [HERE](https://colab.research.google.com/github/Local-eRewards/itpminer/blob/main/demo.ipynb) PIP install itpminer<jupyter_code>!pip install itpminer<jupyter_output><empty_output><jupyter_text>Import itpminer and create a dummy database of inter transactions<jupyter_code>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"]
]<jupyter_output><empty_output><jupyter_text>Mine frequent inter-transactional patterns<jupyter_code>tree_dict, frequent_patterns_dict, frequent_patterns_list, frequent_patterns_dataframe = itp_miner(
    database=database)
frequent_patterns_dataframe<jupyter_output><empty_output><jupyter_text>Derive association rules from frequent patterns<jupyter_code>rules_dict, rules_display_dict, rules_dataframe = association_rules(
    tree_dict=tree_dict)
rules_dataframe<jupyter_output><empty_output><jupyter_text>Plot a network graph between extended items<jupyter_code>rules_graph(rules_display_dict=rules_display_dict, rules_dict=rules_dict)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11226114649681529, 'fraction_numerical': 0.0, 'mean_word_length': 7.79020979020979, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '152254', 'license': 'MIT', 'n_tokens_mistral': 454, 'n_tokens_neox': 441, 'n_words': 77, 'path': 'demo.ipynb', 'repo_name': 'yipchunhrien/itpminer', 'size': '1256'}