Skip to main content

Temporal Generalized Association Rules

This library provides four algorithms related to Association Rule mining. You can download this repository as a package with:

pip install TemporalGeneralizedRules

The algorithms are:

  • Apriori
  • Cumulate
  • HTAR
  • HTGAR

These algorithms use a transactional dataset that is transformed to a vertical format for optimization. Dataset MUST follow the following format:

order_id product_name
1 Bread
1 Milk
2 Bread
2 Beer
3 Eggs

Or if timestamps are provided:

order_id timestamp product_name
1 852087600 Bread
1 852087600 Milk
2 854420400 Bread
2 854420400 Beer
3 854420400 Eggs

For taxonomy file use the following format (don't provide headers):

child parent
Bread Dairy
Milk Dairy
Beer Beverage

One line for each child, parent

Each field is separated by ","

TGAR

This is the main class that must be instantiated once.

Usage

import TemporalGeneralizedRules

tgar = TemporalGeneralizedRules.TGAR()

Apriori

This algorithm has four parameters:

  • filepath: Filepath of the dataset in csv format with the format discussed in the previous section.
  • min_supp: Minimum support threshold.
  • min_conf: Minimum confidence threshold.
  • parallel_count: Optional parameter that enables parallelization in candidate count phase of the algorithm.

Usage

tgar.apriori("dataset.csv", 0.05, 0.5)

Cumulate

This algorithm has six parameters:

  • filepath: Filepath of the dataset in csv format with the format discussed in the previous section.
  • taxonomy_filepath: Filepath of the taxonomy in csv format with the format discussed in the previous section.
  • min_supp: Minimum support threshold.
  • min_conf: Minimum confidence threshold.
  • min_r: Minimum R-interesting threshold.
  • parallel_count: Optional parameter that enables parallelization in candidate count phase of the algorithm. It can make execution faster.

Usage

tgar.cumulate("dataset.csv", 0.05, 0.5, 1.1)

HTAR

This algorithm has four parameters:

  • filepath: Filepath of the dataset in csv format with the format discussed in the previous section.
  • min_supp: Minimum support threshold.
  • min_conf: Minimum confidence threshold.
  • parallel_count: Optional parameter that enables parallelization in candidate count phase of the algorithm. It can make execution faster.

Usage

tgar.htar("dataset.csv", 0.05, 0.5)

HTGAR

This algorithm has six parameters:

  • filepath: Filepath of the dataset in csv format with the format discussed in the previous section.
  • taxonomy_filepath: Filepath of the taxonomy in csv format with the format discussed in the previous section.
  • min_supp: Minimum support threshold.
  • min_conf: Minimum confidence threshold.
  • min_r: Minimum R-interesting threshold.
  • parallel_count: Optional parameter that enables parallelization in candidate count phase of the algorithm. It can make execution faster.

Usage

tgar.htgar("dataset.csv", 0.05, 0.5, 1.1)

Pypy

For a better performance we recommend using this package with Pypy, a faster implementation of python.

https://www.pypy.org/

Bibliography

The algorithms provided in this library were based on the following papers:

Metadata

Release files for TemporalGeneralizedRules 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TemporalGeneralizedRules 1.0.2
File Size Uploaded Provenance
TemporalGeneralizedRules-1.0.2.tar.gz 19.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for TemporalGeneralizedRules 1.0.2
File Interpreter ABI Platform
TemporalGeneralizedRules-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.9 kB

Release files / TemporalGeneralizedRules-1.0.2.tar.gz

Download URL TemporalGeneralizedRules-1.0.2.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aadab622412c079d7ebe46781220081291d787c0bebc67fd657a14e7bdcef71f
BLAKE2b-256 checksum
How to use checksums
9e46732247f1450523ed10114c3a1a01197e974c1d5033fc440c0ed6707af690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / TemporalGeneralizedRules-1.0.2-py3-none-any.whl

Download URL TemporalGeneralizedRules-1.0.2-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12ee7055c558bc57b2accd8bc33152fbb5a575dc995426e7914529a778a52bb7
BLAKE2b-256 checksum
How to use checksums
f18ca94542771a3fa49b9255d3e6c5aefc714598ceae38c1be07d570bd986aeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for TemporalGeneralizedRules 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page