Giter Site home page Giter Site logo

gmcabrita / bloomex Goto Github PK

View Code? Open in Web Editor NEW
113.0 4.0 8.0 90 KB

:hibiscus: A pure Elixir implementation of Scalable Bloom Filters

License: MIT License

Elixir 100.00%
data-structures elixir bloom-filter scalable-bloom-filters hex probabilistic-data-structures

bloomex's Introduction

Gonçalo Mendes Cabrita — @gmcabrita

I'm a Lead Software Engineer based in Portugal.

bloomex's People

Contributors

arpan-kreeti avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar gmcabrita avatar laserx avatar parth-patil avatar ricardobcl avatar thepeoplesbourgeois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bloomex's Issues

Rethink Bloom filter creation API

I'm currently dissatisfied with a subset of the API being used, most specifically:
new/2
new/3
new/5
new_plain_bloom/3

new currently denotes the creation of a Scalable Bloom filter, and new_plain_bloom the creation of a plain Bloom filter.

My current idea is to discard both new/2 and new/3, forcing the user to understand what kind of parameters he's actually using in this Bloom filter.

The function naming is also ambiguous so I'm changing that as well.

Current proposed API:
plain/2, uses the default hash function
plain/3, the user specifies everything
scalable/4, uses the default hash function
scalable/5, the user specifies everything

In the new API plain will denote a regular Bloom filter and scalable a Scalable Bloom filter.

plain bloom filter false positives

It appears that the capacity of the plain bloom filter may be calculated incorrectly. This example

bloom = Bloomex.plain(1000, 0.01)
Enum.reduce(1..1000, bloom, &Bloomex.add(&2, &1))

results in the following bloom filter struct

%Bloomex.Bloom{
  bv: [
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {:array, 1, 0, 0, {3, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
  ],
  error_prob: 0.01,
  hash_func: #Function<1.7646300/1 in Bloomex.plain/2>,
  max: 1,
  mb: 1,
  size: 3
}

It appears that only 3 distinct numbers were actually added to the filter, even though it was initialized with a capacity of 1000 and a false positive rate of 1%. This configuration would be expected to hold around 990 distinct keys. It also seems wrong that the :max field is being set to 1 in this configuration.

If the above configuration is incorrect, or if I am misunderstanding the calculations for the plain filter, please let me know.

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.