Lecture 16 data streams 2

Bloom Filters (Hash Filters)- Filtering a Data Stream

Applications:

Setting

Bloom Filter - Use multiple hash functions!

Flajolet-Martin Algo - Counting Distinct Elements in a Stream

Problem: Data Stream contains items from a universe of elements chosed from a size of size N. Maintian a count of the number of distinct elemnts seen so far. Obvious Approach: Maintain the set of elements seen so far in a hash table. But suppose we do not have enough memory to store all the elements seen so far. Real problem: What if we do not have space to maintain the set of elements seen so far? We wish to estimate the count in an unbiased way. Acept the count may have a little error but limit the prob the error is large.

Applications

Flajolet-Martin Algo - Counting Distinct Elements in a Stream

AMS Method - Estimating Moments in a Stream

Suppose a stream has elements chosen from a set $A$ of $N$ values. Let $m_i$ be the number of times value $i$ occurs in the stream. The $k$th moment is $\sum_{i \in A} (m_i) ^k$.

##Special Cases

Example:

AMS method for the second moment:

(3)