Skip to main content

Python implementation of the Hyper LogLog and Sliding Hyper LogLog cardinality counter algorithms.

Installation:

Use pip install hyperloglog to install from PyPI.

Usage:

import hyperloglog
hll = hyperloglog.HyperLogLog(0.01)  # accept 1% counting error
hll.add("hello")
print(len(hll))  # 1
hll.add("hello")
print(len(hll))  # 1 as items aren't added more than once
hll.add("hello again")
print(len(hll))  # 2

If we add a further 1000 random strings (giving a total of 1002 strings) we’ll have a count roughly within 1% of the true value, in this case it counts 1007 (within +/- 10.2 of the true value)

# add 1000 random 30 char strings to hll
import random
import string
[hll.add("".join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for n in range(30)])) for m in range(1000)]
print(len(hll))  # 1007

Changes:

  • Added Sliding window HLL version

  • Added bias correction from HLL++

References:

  1. http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf

  2. http://hal.archives-ouvertes.fr/docs/00/46/53/13/PDF/sliding_HyperLogLog.pdf

  3. http://research.google.com/pubs/pub40671.html

https://deepwiki.com/badge.svg

Download files

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

Source Distribution

hyperloglog-0.1.8.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperloglog-0.1.8-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file hyperloglog-0.1.8.tar.gz.

File metadata

  • Download URL: hyperloglog-0.1.8.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyperloglog-0.1.8.tar.gz
Algorithm Hash digest
SHA256 919864a909e7de0168ee8de2d01a0ab6cad38806d5d2e5ad71128b32449154dc
MD5 7c092ed7cf1af8ef33b956391a5bbc2c
BLAKE2b-256 a09d5d93535a5cb1bcb0d261703f6f65f4783cd1c064496ad62ac3c344b08ff7

See more details on using hashes here.

File details

Details for the file hyperloglog-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: hyperloglog-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 48.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hyperloglog-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 010caa5c6ff3ca131671f0ae8a1b72dc12f7ed0574439e81f1096438a782297d
MD5 a589e2b48d2b00a75344b94edd460e07
BLAKE2b-256 25e859a0e2d1545d2cfe78d2f824d9446abaad11a28039ea5fc5cbeb0675366b

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 Sentry Error logging StatusPage Status page