2934: "Bloom Filter"

This is, technically, an xkcd forum.
Post Reply
User avatar
ratammer
Gatekeeper
Posts: 736
Joined: Tue Aug 24, 2021 8:22 pm
Location: London

2934: "Bloom Filter"

Post by ratammer »

Image
Title text: Sometimes, you can tell Bloom filters are the wrong tool for the job, but when they're the right one you can never be sure.

Well, all I can say is, TIL what Bloom filters are. And not from the comic - I had to go and look them up.
User avatar
somitomi
Posts: 274
Joined: Tue Aug 24, 2021 8:04 pm
Contact:

Re: 2934: "Bloom Filter"

Post by somitomi »

ratammer wrote: Sat May 18, 2024 6:52 am Well, all I can say is, TIL what Bloom filters are. And not from the comic - I had to go and look them up.
I almost said "same", but having read the first three paragraphs of the Wikipedia article I'm not actually sure I understand the concept
User avatar
chridd
Scorekeeper-Keeper
Posts: 159
Joined: Tue Aug 24, 2021 8:02 pm
Location: west coast US
Contact:

Re: 2934: "Bloom Filter"

Post by chridd »

somitomi wrote: Sat May 18, 2024 8:36 pm
ratammer wrote: Sat May 18, 2024 6:52 am Well, all I can say is, TIL what Bloom filters are. And not from the comic - I had to go and look them up.
I almost said "same", but having read the first three paragraphs of the Wikipedia article I'm not actually sure I understand the concept
It's a way of "approximately" representing a set of values. In a simple version, you have some number of bits, and for each element of the set, you set one of the bits to 1 based on a hash of that element. Then if you want to look up an element of that set, you can check the bit corresponding to that element's hash. If it's a 1, then the element might be in the set (or there might just be another element with the same hash), but if it's a 0, then the element is definitely not.

This could be useful, for instance, if the actual full set of values is stored somewhere that's slow to access; you could have the bloom filter on smaller local memory, and so sometimes you can quickly say "no, that's not in the set" without having to access the full set.

A more complicated version sets more than one bit per value (say, 3), and then checks if all of them are 1 when looking up a value. If any of the bits is 0, then the element is definitely not in the set.

Does that make more sense?
~ chri d. d. /tʃɹɪ.di.di/ · she · Forum game scores · My website
ratammer wrote: Thu Sep 09, 2021 4:56 pm Hoping to find something quotable on this new forum!
Post Reply