Skip to main content

A simple apriori algorithm python implementation

Project description

Apriori Algorithm Python Implementation

How to use

Install the Pypi package using pip

pip install apriori_python

Then use it like

from apriori_python import apriori
itemSetList = [['eggs', 'bacon', 'soup'],
                ['eggs', 'bacon', 'apple'],
                ['soup', 'bacon', 'banana']]
freqItemSet, rules = apriori(itemSetList, minSup=0.5, minConf=0.5)
print(rules)  
# [[{'beer'}, {'rice'}, 0.6666666666666666], [{'rice'}, {'beer'}, 1.0]]
# rules[0] --> rules[1], confidence = rules[2]

Clone the repo

To run the program with dataset provided and default values for minSupport = 0.5 and minConfidence = 0.5

python apriori.py -f dataset.csv

To run program with dataset and min support and min confidence

python apriori.py -f dataset.csv -s 0.17 -c 0.68

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

apriori_python-1.0.4.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

apriori_python-1.0.4-py3-none-any.whl (5.0 kB view hashes)

Uploaded 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