Skip to main content

A Library with Fast Sketching Primitives

Project description

Fast Sketches

While implementing a paper, we had to create a new library for Count-Min Sketches and Count-Sketches, as current solutions were inadequate. C++ libraries are difficult to use, and Python packages tend to be slow. Thus, we wrote a Python package that contains Python bindings to a C++ library to calculate the predictions of the count-min sketch and count-sketches. This code is located in fast_sketches.cpp.

We include a Python Package that contains Python bindings to a C++ library to calculate the results of the count-min sketch and count-sketches.

NOTE: this only works on Mac in our current version.

First, you will need pybind11, so run

pip install pybind11

Then, run

sh build.sh to install the sketches library. This library implements two functions:

[numpy array of long longs] cm_sketch_preds(int nhashes, [numpy array of long longs] np_input, ll width, int seed)

takes as input a random seed, the number of hashes, the width of the sketch (or the number of cells in each row), and the frequencies of each key. Then, it outputs what a count-min sketch would give as predicted frequencies with that particular set of parameters.

For example,

[numpy array of long longs] count_sketch_preds(int nhashes, [numpy array of long longs] np_input, ll width, int seed)

performs the same function for the Count-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

quick_sketches-0.0.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distributions

quick_sketches-0.0.1-cp38-cp38-win_amd64.whl (58.0 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

quick_sketches-0.0.1-cp38-cp38-win32.whl (51.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

quick_sketches-0.0.1-cp38-cp38-manylinux2010_x86_64.whl (88.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

quick_sketches-0.0.1-cp38-cp38-manylinux2010_i686.whl (95.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

quick_sketches-0.0.1-cp38-cp38-macosx_10_9_x86_64.whl (56.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page