Skip to main content

A Python implementation of the Frequent Pattern Growth algorithm.

Project description

FP-Growth

https://img.shields.io/pypi/v/pyfpgrowth.svg https://img.shields.io/travis/evandempsey/fp-growth.svg Documentation Status

A Python implementation of the Frequent Pattern Growth algorithm.

Getting Started

You can install the package with pip:

pip install pyfpgrowth

Then, to use it in a project, inport it and use the find_frequent_patterns and generate_association_rules functions:

import pyfpgrowth

It is assumed that your transactions are a sequence of sequences representing items in baskets. The item IDs are integers:

transactions = [[1, 2, 5],
                [2, 4],
                [2, 3],
                [1, 2, 4],
                [1, 3],
                [2, 3],
                [1, 3],
                [1, 2, 3, 5],
                [1, 2, 3]]

Use find_frequent_patterns to find patterns in baskets that occur over the support threshold:

patterns = pyfpgrowth.find_frequent_patterns(transactions, 2)

Use generate_association_rules to find patterns that are associated with another with a certain minimum probability:

rules = pyfpgrowth.generate_association_rules(patterns, 0.7)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

1.0 (2016-04-25)

  • First release on PyPI.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfpgrowth-1.0.tar.gz (1.6 MB view details)

Uploaded Source

File details

Details for the file pyfpgrowth-1.0.tar.gz.

File metadata

  • Download URL: pyfpgrowth-1.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyfpgrowth-1.0.tar.gz
Algorithm Hash digest
SHA256 a3e5780385241d90d3ae5cabcca767eb65427b0a908014d42164b3ea8899f1d0
MD5 44ceef99e55f3d8e4dd3b695b004c9bf
BLAKE2b-256 d24c8b7cd90b4118ff0286d6584909b99e1ca5642bdc9072fa5a8dd361c864a0

See more details on using hashes here.

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