Skip to main content

Simple Apriori algorithm Implementation.

Project description

Apyori is a simple implementation of Apriori algorithm with Python 2.7 and 3.3 - 3.5, provided as APIs and as commandline interfaces.

https://travis-ci.org/ymoch/apyori.svg?branch=master https://coveralls.io/repos/github/ymoch/apyori/badge.svg?branch=master

Module Features

  • Consisted of only one file and depends on no other libraries, which enable you to use it portably.

  • Able to used as APIs.

Application Features

  • Supports a JSON output format.

  • Supports a TSV output format for 2-items relations.

Installation

Choose one from the following.

  • Put apyori.py into your project.

  • Run python setup.py install.

API Usage

Here is a basic example:

from apyori import apriori

transactions = [
    ['beer', 'nuts'],
    ['beer', 'cheese'],
]
results = list(apriori(transactions))

For more details, see apyori.apriori pydoc.

CLI Usage

First, prepare input data as tab-separated transactions.

  • Each item is separated with a tab.

  • Each transactions is separated with a line feed code.

Second, run the application. Input data is given as a standard input or file paths.

  • Run with python apyori.py command.

  • If installed, you can also run with apyori-run command.

For more details, use ‘-h’ option.

Samples

Basic usage

apyori-run < data/integration_test_input_1.tsv

Use TSV output

apyori-run -f tsv < data/integration_test_input_1.tsv

Fields of output mean:

  • Base item.

  • Appended item.

  • Support.

  • Confidence.

  • Lift.

Specify the minimum support

apyori-run -s 0.5 < data/integration_test_input_1.tsv

Specify the minimum confidence

apyori-run -c 0.5 < data/integration_test_input_1.tsv

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

apyori-1.0.0.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file apyori-1.0.0.tar.gz.

File metadata

  • Download URL: apyori-1.0.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for apyori-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9ce777f553e4acd6d5454c30c010441f3c615fcc03b927a8af1932a62ab5ee07
MD5 2db41437eee20cc87836dafa63ddfb01
BLAKE2b-256 d7a99fe7d9ef4d2f57c3391b6f71864afbf379d3b9614ad6fddc24de141bfe07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page