Giter Site home page Giter Site logo

countminsketch's Introduction

CountMinSketch

This is a minimalistic Count-min Sketch for Python, featuring some cool things like:

  • Being able to count anything that is hash-able by python (numbers, strings, tuples, inmutables, duck-typeds, etc.).
  • Tests
  • No dependencies
  • No foreign languages, just 100% python.

This software was written by Rafael Carrascosa, you can contact me at rafacarrascosa on gmail.

Usage

from countminsketch import CountMinSketch
sketch = CountMinSketch(1000, 10)  # table size=1000, hash functions=10
sketch.add("oh yeah")
sketch.add(tuple())
sketch.add(1, value=123)
print sketch["oh yeah"]       # prints 1
print sketch[tuple()]         # prints 1
print sketch[1]               # prints 123
print sketch["non-existent"]  # prints 0

Install

CountMinSketch is on PyPI, so you can install it with

pip install countminsketch

License

BSD 3-clause, see the LICENSE file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.