Skip to main content

Weighted Quantile Sketch

Project description

wqsketch

Developed by Benjamin Tay

Implements Algorithm 1 and 2 from the DDSKetch paper. http://www.vldb.org/pvldb/vol12/p2195-masson.pdf

Examples

Basic Usage

from wqsketch import create_sketch
from wqsketch import calculate_quantile
from wqsketch import merge_sketch
import numpy as np

data1 = 2 * np.random.random_sample((100,)) - 1
data2 = data1 + 1
data3 = data1 - 1

sketch1 = create_sketch(data1)
sketch2 = create_sketch(data2)
sketch3 = create_sketch(data3)

sketch1_median = calculate_quantile(0.5, sketch1)
sketch2_median = calculate_quantile(0.5, sketch2)
sketch3_median = calculate_quantile(0.5, sketch3)

sketch_list=[]
sketch_list.append(sketch1)
sketch_list.append(sketch2)
sketch_list.append(sketch3)

merged_sketch = merge_sketch(sketch_list)

merged_sketch_median = calculate_quantile(0.5,merged_sketch)

Notes

create_sketch takes 3 arguments: the data vector, alpha, and the weight.

alpha (accuracy of the quantile) defaults to 0.01.

weights default to 1.

merge_sketch takes 1 argument: a list of sketches

calculate_quantile takes 2 arguments: the quantile to calculate and the sketch

Project details


Download files

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

Source Distribution

wqsketch-0.0.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

wqsketch-0.0.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file wqsketch-0.0.2.tar.gz.

File metadata

  • Download URL: wqsketch-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for wqsketch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3fb8a24b1872d37b8909dd18020dd3605dc0195d1f2c82cc1a5fdfcc75e38b44
MD5 5b67b9d7a08243acaa7a4d46f3167e2b
BLAKE2b-256 a5fab9b22108db43b34467c76a25684ce0703bd8ec7faa24615d5bf28d4c0bf6

See more details on using hashes here.

File details

Details for the file wqsketch-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wqsketch-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for wqsketch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a5ba281a0aa1c29cf64a01273d861d3c14411667a8ef47b64eead914a548e6b
MD5 a0afac44a5463e6b0719b860dd2f61ad
BLAKE2b-256 d7e319b28dd90362aae62ea76e7e8c56012f5e1037b50ba9db56328fcfe29b47

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