Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Python implementation of the dgim algorithm: Compact datastructure to estimate the number of "True" in the last N elements of a boolean stream.

Project Description

Python implementation of the dgim algorithm: Compact datastructure to estimate the number of “True” in the last N elements of a boolean stream.

Features

  • Estimation of the number of “True” statements in the last N element of a boolean stream
  • Configurable error rate

Installation

At the command line:

$ pip install dgim

Usage

Basic:

from dgim import Dgim
dgim = Dgim(N=32)
for i in range(100):
    dgim.update(True)
print "Number of 'True' statements in the last 32 elements"
exact_result = 32
print "- Exact result : {}".format(exact_result)
dgim_result = dgim.get_count() # 28
print "- Dgim estimation: {}".format(dgim_result)

Custom error rate:

from dgim import Dgim
dgim = Dgim(N=32, error_rate=0.1)
for i in range(100):
    dgim.update(True)
print "Number of 'True' statements in the last 32 elements"
exact_result = 32
print "- Exact result : {}".format(exact_result)
dgim_result = dgim.get_count() # 30
print "- Dgim estimation: {}".format(dgim_result)

License

The project is licensed under the BSD license.

Authors

How to contribute

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
  3. Write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.

References

History

0.1.0 (2014-12-31)

  • First release on PyPI.
Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dgim-0.1.0.tar.gz (15.3 kB) Copy SHA256 Checksum SHA256 Source Jan 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting