Skip to main content

Probabilistic data structures in python

Project description

https://badge.fury.io/py/pyprobables.svg https://coveralls.io/repos/github/barrust/pyprobables/badge.svg https://travis-ci.org/barrust/pyprobables.svg?branch=master Documentation Status License

pyprobables is a python library for probabilistic data structures. The goal is to provide the developer with a pure-python implementation of common probabilistic data-structures to use in their work.

Installation

Pip Installation:

$ pip install pyprobables

To install from source:

To install pyprobables, simply clone the repository on GitHub, then run from the folder:

$ python setup.py install

pyprobables supports python versions 2.7 and 3.3 - 3.6

API Documentation

The documentation of is hosted on readthedocs.io

You can build the documentation locally by running:

$ pip install sphinx
$ cd docs/
$ make html

Automated Tests

To run automated tests, one must simply run the following command from the downloaded folder:

$ python setup.py test

Quickstart

Import pyprobables and setup a Bloom Filter:

>>> from probables import (BloomFilter)
>>> blm = BloomFilter(est_elements=1000, false_positive_rate=0.05)
>>> blm.add('google.com')
>>> blm.check('facebook.com')  # should return False
>>> blm.check('google.com')  # should return True

Import pyprobables and setup a Count-Min Sketch:

>>> from probables import (CountMinSketch)
>>> cms = CountMinSketch(width=1000, depth=5)
>>> cms.add('google.com')  # should return 1
>>> cms.add('facebook.com', 25)  # insert 25 at once; should return 25

See the API documentation for other data structures available and the quickstart page for more examples!

Changelog

Please see the changelog for a list of all changes.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyprobables-0.0.5-py2.py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 2 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