Skip to main content

pyARC

License: MIT

pyARC is an implementation of CBA (Classification Based on Assocation) algorithm introduced in

Liu, B. Hsu, W. and Ma, Y (1998). Integrating Classification and Association Rule Mining. Proceedings KDD-98, New York, 27-31 August. AAAI. pp 80-86.

In addition, pyARC contains the implementation of QCBA (Quantitative CBA) algorithm introduced in

KLIEGR, Tomas. Quantitative CBA: Small and Comprehensible Association Rule Classification Models. arXiv preprint arXiv:1711.10166, 2017.

The use of QCBA algorithm is demonstrated in this jupyter notebook.

The fim package is used for the rule generation step.

If you find this package useful in your research, please cite (EasyChair link):

 @techreport{filip2018classification,
  title={Classification based on Associations (CBA)-a performance analysis},
  author={Filip, Ji{\v{r}}{\'\i} and Kliegr, Tom{\'a}{\v{s}}},
  year={2018},
  institution={EasyChair}
}

Installation

pip install pyarc

For using pyARC, the fim package needs to be installed (refer to http://www.borgelt.net/pyfim.html for installation guide).

Testing

python -m unittest discover -s pyarc/test  -p '*test_*.py'

Examples

Simplest example

from pyarc import CBA, TransactionDB
import pandas as pd

data_train = pd.read_csv("iris.csv")
data_test = pd.read_csv("iris.csv")

txns_train = TransactionDB.from_DataFrame(data_train)
txns_test = TransactionDB.from_DataFrame(data_test)


cba = CBA(support=0.20, confidence=0.5, algorithm="m1")
cba.fit(txns_train)

accuracy = cba.rule_model_accuracy(txns_test) 

Using top_rules function to mine the best rules possible

from pyarc import TransactionDB
from pyarc.algorithms import (
    top_rules,
    createCARs,
    M1Algorithm,
    M2Algorithm
)
import pandas as pd


data_train = pd.read_csv("iris.csv")
data_test = pd.read_csv("iris.csv")

txns_train = TransactionDB.from_DataFrame(data_train)
txns_test = TransactionDB.from_DataFrame(data_test)

# get the best association rules
rules = top_rules(txns_train.string_representation)

# convert them to class association rules
cars = createCARs(rules)

classifier = M1Algorithm(cars, txns_train).build()
# classifier = M2Algorithm(cars, txns_train).build()

accuracy = classifier.test_transactions(txns_test)

Metadata

Release files for pyarc 1.1.4

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

Source distribution (sdist)

Source distribution for pyarc 1.1.4
File Size Uploaded Provenance Actions
pyarc-1.1.4.tar.gz 25.8 kB Without provenance Details for pyarc-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyarc 1.1.4
File Interpreter ABI Platform Actions
pyarc-1.1.4-py2.py3-none-any.whl Python 3, Python 2 none any Details for pyarc-1.1.4-py2.py3-none-any.whl

Total release size: 61.9 kB

Release files / pyarc-1.1.4.tar.gz

Download URL pyarc-1.1.4.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3d7587313c09c762700fe3c9cef46d3a498fde67d3de4055557cb5f047d63a32
BLAKE2b-256 checksum
How to use checksums
3d453461d987932d1165ccb83b44882e88a1d9ab299ff212ac4a378479623c13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / pyarc-1.1.4-py2.py3-none-any.whl

Download URL pyarc-1.1.4-py2.py3-none-any.whl
Size 36.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
beb5669262637eb2dc92b01839e4ca576c87d0424926a818e39f235bb11b4a7e
BLAKE2b-256 checksum
How to use checksums
910932560e0df50f084e03f344bb57196bbcfbeec90a8f7aa982043be6bc7f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Security for pyarc 1.1.4

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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