Skip to main content
https://badge.fury.io/py/dgim.png https://travis-ci.org/simondolle/dgim.png?branch=master https://pypip.in/d/dgim/badge.png

Python implementation of the DGIM algorithm: a compact datastructure to estimate the number of True statements 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

  • Low memory footprint.

  • Tunable error rate (the lower the error rate, the higher the memory footprint)

Applications

When processing large streams of data such as clicks streams, server logs, financial streams. It is often necessary to maintain statistics about the N latest elements. If N is big or if you have many streams to process, it is not possible to store the N latest elements.

In such situations, if the processed stream is made of boolean, the DGIM algorithm can help you estimate the number of True statements in the last elements.

For instance, if the stream is made of server logs, DGIM algorithm can estimate the proportion of visits that come from search engines. (as opposed to direct access, or access through paid search)

Installation

At the command line:

$ pip install dgim

Usage

Sample code:

from dgim import Dgim
dgim = Dgim(N=32, error_rate=0.1)
for i in range(100):
    dgim.update(True)
dgim_result = dgim.get_count() # 30 (exact result is 32)

Documentation

https://dgim.readthedocs.org.

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.2.0 (2015-01-05)

  • Improved documentation

  • Make most methods and attribute private.

0.1.0 (2015-01-04)

  • First release on PyPI.

Release files for dgim 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dgim 0.2.0
File Size Uploaded
dgim-0.2.0.tar.gz 17.6 kB Details

Release files / dgim-0.2.0.tar.gz

Download URL dgim-0.2.0.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5e50617a080829a7d3acb1bdad265bc216e39204f9e45286a0e84099a6b5e6b7
BLAKE2b-256 checksum
How to use checksums
75b93f0fc6309229e32570b072ae49981c3adbdfb8a520288d24f84ab5025d64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page