Docsity

Mining Data Streams-Data Mining-Lecture 06 Slides-Computer Science, Slides of Data Mining

Partial preview of the text

Download Mining Data Streams-Data Mining-Lecture 06 Slides-Computer Science and more Slides Data Mining in PDF only on Docsity!

Mining Data Streams

The Stream Model

Sliding Windows

Counting 1’s

The Stream Model

Data enters at a rapid rate from one or more input ports.

The system cannot store the entire stream.

How do you make critical calculations about the stream using a limitedamount of (secondary) memory?

Applications --- (1)

In general, stream processing is important for applications where



New data arrives frequently.



Important queries tend to ask about themost recent data, or summaries of data.

Applications --- (2)

Mining query streams.



Google wants to know what queries aremore frequent today than yesterday.

Mining click streams.



Yahoo wants to know which of its pagesare getting an unusual number of hits inthe past hour.

Applications --- (4)

Intelligence-gathering.



Like “evil-doers visit hotels” at beginning ofcourse, but much more data at a muchfaster rate.

Who calls whom?

Who accesses which Web pages?

Who buys what where?

Sliding Windows

A useful model of stream processing is that queries are about a

window

of

length

N

--- the

N

most recent

elements received.

Interesting case:

N

is still so large that

it cannot be stored on disk.



Or, there are so many streams thatwindows for all cannot be stored.

Counting Bits --- (1)

Problem

: given a stream of 0’s and 1’s,

be prepared to answer queries of theform “how many 1’s in the last

k

bits?”

where

k

N

Obvious solution

: store the most recent

N

bits.



When new bit comes in, discard the

N

st

bit.

Counting Bits --- (2)

You can’t get an exact answer without storing the entire window.

Real Problem

: what if we cannot afford

to store

N

bits?



E.g., we are processing 1 billion streamsand

N

= 1 billion, but we’re happy with an

approximate answer.

13

Example

0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 1 0

1 1 2 2 3 4

10

N

We can construct the count ofthe last

N

bits, except we’re

Not sure how many of the last6 are included.

?

6

What’s Good?

Stores only O(log

2

N

) bits.

Easy update as more bits enter.

Error in count no greater than the number of 1’s in the “unknown” area.

Fixup

Instead of summarizing fixed-length blocks, summarize blocks with specificnumbers of 1’s.



Let the block “sizes” (number of 1’s)increase exponentially.

When there are few 1’s in the window, block sizes stay small, so errors aresmall.

DGIM* Method

Store O(log

2

N

) bits per stream.

Gives approximate answer, never off by more than 50%.



Error factor can be reduced to any fraction> 0, with more complicated algorithm andproportionally more stored bits.

*Datar, Gionis, Indyk, and Motwani

Buckets

A

bucket

in the DGIM method is a

record consisting of:

The timestamp of its end [O(log

N

) bits].

The number of 1’s between its beginningand end [O(log log

N

) bits].

Constraint on buckets

: number of 1’s

must be a power of 2.



That explains the log log

N

in (2).

Representing a Stream by Buckets

Either one or two buckets with the same power-of-2 number of 1’s.

Buckets do not overlap in timestamps.

Buckets are sorted by

size

(# of 1’s).



Earlier buckets are not smaller than laterbuckets.

Buckets disappear when their end-time is >

N

time units in the past.