cs345-streams2-3

# cs345-streams2-3 - 1 More Stream-Mining Counting Distinct...

This preview shows pages 1–9. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 More Stream-Mining Counting Distinct Elements Computing “Moments” Frequent Itemsets Elephants and Troops Exponentially Decaying Windows 2 Counting Distinct Elements ◆ Problem : a data stream consists of elements chosen from a set of size n . Maintain a count of the number of distinct elements seen so far. ◆ Obvious approach : maintain the set of elements seen. 3 Applications ◆ How many different words are found among the Web pages being crawled at a site? ◗ Unusually low or high numbers could indicate artificial pages (spam?). ◆ How many different Web pages does each customer request in a week? 4 Using Small Storage ◆ Real Problem : what if we do not have space to store the complete set? ◆ Estimate the count in an unbiased way. ◆ Accept that the count may be in error, but limit the probability that the error is large. 5 Flajolet-Martin* Approach ◆ Pick a hash function h that maps each of the n elements to at least log 2 n bits. ◆ For each stream element a , let r ( a ) be the number of trailing 0’s in h ( a ). ◆ Record R = the maximum r ( a ) seen. ◆ Estimate = 2 R . * Really based on a variant due to AMS (Alon, Matias, and Szegedy) 6 Why It Works ◆ The probability that a given h ( a ) ends in at least r 0’s is 2-r . ◆ If there are m different elements, the probability that R ≥ r is 1 – (1 - 2-r ) m . Prob. a given h(a) ends in fewer than r 0’s. Prob. all h(a)’s end in fewer than r 0’s. 7 Why It Works – (2) ◆ Since 2-r is small, 1 - (1-2-r ) m ≈ 1 - e -m2 . ◆ If 2 r >> m , 1 - (1 - 2-r ) m ≈ 1 - (1 - m2-r ) ≈ m /2 r ≈ 0. ◆ If 2 r << m , 1 - (1 - 2-r ) m ≈ 1 - e -m2 ≈ 1. ◆ Thus, 2 R will almost always be around m .-r-r First 2 terms of the Taylor expansion of e 8 Why It Doesn’t Work ◆ E(2 R ) is actually infinite. ◗ Probability halves when R -> R +1, but value doubles. ◆ Workaround involves using many hash functions and getting many samples. ◆ How are samples combined?...
View Full Document

{[ snackBarMessage ]}

### Page1 / 36

cs345-streams2-3 - 1 More Stream-Mining Counting Distinct...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online