Docsity

Data Streams Lecture 14: Synopses and Data Mining - Prof. David E. Maier, Study notes of Computer Science

Toggle sidebar
bg1
Data Streams 07: Lecture 14
1
CS 410/510
Dt St
D
a
t
a
St
reams
Lecture 14: Synopses and Data
Mining
David Maier, Kristin Tufte
11/12/2007 Data Streams: Lecture 14 1
Other References
Cormode, Muthukrishnan. An Improved
Data Stream Summary: The Count-Min
Sk t h d it A li ti
Jl f
Sk
e
t
c
h
an
d it
s
A
pp
li
ca
ti
on.
J
ourna
l
o
f
Algorithms,
April 2005.
Greenwald, Khanna. Space-Efficient Online
Computation of Quantile Summaries.
SIGMOD 2001
.
11/12/2007 Data Streams: Lecture 14 2
Cormode, Johnson, et al. Holistic UDAFs at
Streaming Speeds.
SIGMOD 2004
.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Data Streams Lecture 14: Synopses and Data Mining - Prof. David E. Maier and more Study notes Computer Science in PDF only on Docsity!

  • 11/12/2007 Other References „ Cormode, Muthukrishnan. An ImprovedData Stream Summary: The Count-MinSk t hSketch and its Application. CS 410/510D tData StreamsLecture 14: Synopses and DataMining David Maier, Kristin Tufte Std it AData Streams: Lecture 14 li ti JJournal of l f
  • „ 11/12/2007 „ Algorithms, April 2005.Greenwald, Khanna. Space-Efficient OnlineComputation of Quantile Summaries.SIGMOD 2001.Cormode, Johnson, et al. Holistic UDAFs atStreaming Speeds. Data Streams: Lecture 14SIGMOD 2004.
  • 43 Use first digit as hash h1() Keeping Counts with HashFunctions 11/12/2007 Save Space by CombiningEntries 41 43 14:1 1 21 21:2 2 41 43 32:2 3 Data Streams: Lecture 14 32 41:3 43:544:1 43 4 44 12 21 43 32
  • 43 Use slot i for all values with h1(v) = i 11/12/2007 41 43 11 21 22 41 43 2 3 Data Streams: Lecture 14 32 43 94 44 12 21 43 32
  • 43 Use value in slot h1(v) for count(v) value:est:real: Estimating Count(v) 11/12/2007 Improve Estimate with MultipleHash Tables 41 43 11 12 1121 21 22 22 41 32 2243 41 2 93 3 Data Streams: Lecture 14 32 43 9543 94 44 9144 12 21 43 32
  • 43 Use second digit as hash h2() 11/12/2007 41 43 1511 21 2322 41 43 25 33 Data Streams: Lecture 14 32 43 9144 44 12 21 43 32
  • 43 Use min(h1(v) h2(v)) to estimate count(v)Use min(h1(v) value:est:real: Estimate with Min of Hash Entries 11/12/2007 Generalize to Multiple HashTables 41 43 15511 12 1121 21 22 23322 41 , h2(v)) to estimate count(v) 32 2243 41 255 53 33 Data Streams: Lecture 14 32 43 5543 91144 44 1144 12 21 43 32
  • Use d hash tables, each of length wNNeed d independent hash functions h1, h2, …,Store in one table 11/12/2007 Estimate count(v) as min hd ‰ ‰ count[1..d, 1..w] (call theon update, for j = 1..d, count[j, hj(v)]++d d i d p , dj Data Streams: Lecture 14h , h f j(count[j, hj(v)])sketch) [j, ij( )] h1 h2
  • Probabilistic Guarantee AssumesEError of estimate proportional toError bound exceeded < 1/2For example with N = 1000 w = 50 d = 5 11/12/2007 For example Works with Sums, too N/wError bound is 1000/50 = 20Could miss that bound 1/32 of the time f (N is number of elements seen)independent hash functionsi, with N = 1000, w = 50, d = 5 Data Streams: Lecture 14i d of the timel
  • Have tuples (v, amt)U dUpdate is count[j, hj(v)] += amtError bound is (total-sum)/w 11/12/2007 i [j hj( )]Data Streams: Lecture
  • Heavy Hitters Easy, given v, to get estimate of count(v)What if, for 0 < s < 1, want to know all v withCould generate all possible values of v and 11/12/2007 Could generate all possible values of v and Alternative 1estimated count(v) > sN? look up. Data Streams: Lecture
  • If we know s in advance„ „Details 11/12/2007 WhWhsee if estimated count(v) > sNIf so, add v to the Heavy-Hitters list ‰ ‰ ‰ v might cease being a heavy hitter after morev might cease being a heavy hitter after more inputkeep Heavy-Hitters as a heap, remove minelement u if count(u) < sN enever we do an update for element v,d Data Streams: Lecture 14d f l
  • Alternative 1: Space Amount of extra space depends on sCan’t have more than 1/s heavy hitters 11/12/2007 Alternative 2For example, no more than 20 heavy hitters forError bound might bump that up a bits = .05 Data Streams: Lecture
  • We don’t know s in advanceKeep several sketches using prefixes ofKeep several sketches, using prefixes ofFor example, if we have 32-bit values 11/12/2007value ‰ ‰ ‰ ‰ sketch on all 32 bitssketch on first 24 bitssketch on first 16 bitssketch (or exact counts) on first 8 bits k t h fi t 24 bitData Streams: Lecture
  • Alternative 2: Finding HeavyHitters Enumerate all heavy hitters in the 8-bit Check against 16-bit sketchSimilarly with 24-bit and 32-bit 11/12/2007 Note that the number of candidates at each Finding Quantilessketch:sketch:Ifstage is bounded by 1/s3CFF 3C was a heavy hitter in 8-bit, check in 16-bit 0000 - FFFFData Streams: Lecture 14 3C00 –
  • “Give me the median, 75Reduces to the problem of finding theSuppose there are N = 2000 values 11/12/2007percentile values for temperature”percentile values for temperatureelement of a particular rank ‰ ‰ ‰ Median: rank 1000 7590 thth percentile: rank 1500percentile: rank 1800Data Streams: Lecture 14 th percentile and 90 th
  • Quantile Summaries:Error and Space Want to find element v of rank r with errorWant space to depend on error bound 11/12/2007 Keep Sample Values and Rangeof Possible Ranksfactor efactor eWill settle for v’, with rank(v’) in [r – eN, r + eN] ‰ this method uses space proportional to Note this doesn’t bound |v – v’|(1/e)log (eN) Data Streams: Lecture
  • For sample value v, want minrank(v) and“Close” will be 2eN 11/12/2007maxrank(v)maxrank(v) ‰ ‰For example, if N = 1000, e = .01, then close is 20 Want minrank and maxrank “close”Want sample elements “close” Data Streams: Lecture
  • Example Intervals Assume values are stock prices 11/12/2007 Bound Span of Adjacent Intervals Consecutive intervals are within 2eN (= 20) 179 8.95 185 Data Streams: Lecture 14 190 9.10 194 197 9.12
  • 11/12/2007^179 8.95^185 ≤Data Streams: Lecture 14^20190 9.10^194 197 ≤^20 9.12
  • Rank r Estimate Want [minrank(v), maxrank(v)] in [r-eN, r+eN] 11/12/2007 Example: Rank r = 180 Which interval is in [r-10, r+10] = [170, 190]? 179 8.95 185 ≤Data Streams: Lecture 14 20190 9.10 194 197 ≤ 20 9.12
  • 170 11/12/2007^179 8.95^185 Data Streams: Lecture 14^190190 9.10^194 197 9.12
  • Example: Rank r = 191 Which interval is in [181, 201]? 11/12/2007 Example: Rank r = 195 Which interval is in [185, 205]? 179181 8.95 185 Data Streams: Lecture 14 190 9.10 194 197 9.12
  • 11/12/2007^179 8.95^185185 Data Streams: Lecture 14^190 9.10^194 197 9.12
  • What If There Is No Interval? What’s wrong with this picture? 11/12/2007 Insert New Value How do we adjust when adding value 9.05? 179 180 8.95 185 Data Streams: Lecture 14 194 9.12
  • 11/12/2007^179180 8.95^185 9.05 Data Streams: Lecture 14^190 9.10^194 197197 9.12
  • Insert New Value How do we adjust when adding value 9.05? 11/12/2007 Pruning Intervals What if N grows to 1500, 2eN = 30? 179180 8.95 185 9.05 Data Streams: Lecture 14 191 9.10 195 197198 9.12
  • 11/12/2007^179180 8.95^185 9.05 Data Streams: Lecture 14^191 9.10^195 197198 9.12
  • Make Adjustments Less Costly Store offset and range 11/12/2007 Tuple Structure for Sample Value 179 8.95 6 11185 Data Streams: Lecture 14 190 4 9.10 7 194 197 9.12
  • Use t„ „ „ 11/12/2007 vGD i i i iis the value is the offset = minrank(v is the range = maxrank(v i = (vh i , Gli , Di ) Data Streams: Lecture 14 i i ) – minrank(v ) – minrank(v i i-1 ) )
  • Adding value 9.05: offset = 1, range = 11 + 7 - 1 With Triples Store offset and range – localizes update 11/12/2007 Insert New Tuple^179 8.95, 9, 6^185 Data Streams: Lecture 14^190 9.10, 11, 7^194 197 9.12, 4,
  • 11/12/2007^179180 8.95, 9, 6^185 9.05, Data Streams: Lecture 14 1, 17^191 9.10, 11, 7^195 197198 9.12, 4,
  • Deleting 9.10: Adjust 9.12 offset = 11 + 4 Deleting Tuple 11/12/2007 Association Rules 179180 8.95, 9, 6 185 9.05, Data Streams: Lecture 14 1, 17 191 9.10, 11, 7 195 197198 9.12, 15,
  • Items (as in store or catalog)IItem set: some collection of items 11/12/2007 GGGL - glovesRH - rollerRT - roller DCFD - feather - glue- drop guncloth headtray dusterllData Streams: Lecture 14 GSRO - rolleri - glue f i sticks
  • Transactions (Baskets) 11/12/2007 Association Rule T1 {GG}T2 {GG,T2T4T5T6T7 T8T9T10 {{FD,{RO,{RO,{GG,{GG,{RO,{RO, {GS,, GS}GL,RH,RT,GL,GS,RT,RH, DC}} RO}RT}RH,GS,DC}RH,GL}Data Streams: Lecture 14 DC}DC}DC}
  • Format: XMMeans see items in Y whenever you see items A. GSB. RO, RHC 11/12/2007 C FD, GL in XFD ⇒GL ⇒iGG ⇒⇒⇒Y, where X and Y disjoint DCROROi Data Streams: Lecture 14Y h i
  • Confidence f(X): number of transactions containing allConfidence in X 11/12/2007 Supportitems in set Xitems in set Xf(X + Y)/f(X) A.B. f(RO,RH) C. f(FD,GL) f(GS) = 4, = 4, f(RO,RH,DC)= 1, f(FD,GL,RO)⇒ f(GS, Data Streams: Lecture 14Y GG) = 3, 75%= 2, 50%= 1, 100%
  • High confidence isn’t whole storySSupport of X 11/12/2007 Retail: Million transactions, 5000 items, support = 1% to .01%f(X + Y)/N A. 30%B. 20%C. 10% f X ⇒N = number of transactions YY:Data Streams: Lecture
  • 11/12/2007 Apriori (Agrawal & Srikant) Problem Statement Given a collection of transactions, find allNote: If f(X + Y) Large item set: at least sN items Large item set: at least sN itemsassociation rules that have confidenceat least c and support at least s f(RH, DC) = 2,Data Streams: Lecture 14 ≥ f(DC)sN, then f(X) =^5 ≥ sN
  • A. Find large itemsets f(X)B. Generate qualifying rule X 11/12/2007and the value of f(X) for each(can use count estimates instead)if X + Y large and f(X + Y)/f(X) d th l f f(X) fData Streams: Lecture 14 h≥ ⇒ sN≥ cY