Metadata-Version: 2.1
Name: wqsketch
Version: 0.0.2
Summary: Weighted Quantile Sketch
Home-page: UNKNOWN
Author: Benjamin Tay
Author-email: <benjamin.tay85@gmail.com>
License: UNKNOWN
Keywords: weighted,quantile,sketch,mergeable
Platform: UNKNOWN
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
Requires-Dist: numpy


# 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

```python
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

