CS341 info session is on Thu 3/1 5pm in Gates415. CS246: Mining Massive Datasets Jure Leskovec, Stanford University

Similar documents
CS246: Mining Massive Datasets Jure Leskovec, Stanford University

4/26/2017. More algorithms for streams: Each element of data stream is a tuple Given a list of keys S Determine which tuples of stream are in S

CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #15: Mining Streams 2

Streaming - 2. Bloom Filters, Distinct Item counting, Computing moments. credits:

Data Stream Analytics

CS5112: Algorithms and Data Structures for Applications

Mining Data Streams. The Stream Model. The Stream Model Sliding Windows Counting 1 s

Mining Data Streams. The Stream Model Sliding Windows Counting 1 s

CS246 Final Exam. March 16, :30AM - 11:30AM

12 Count-Min Sketch and Apriori Algorithm (and Bloom Filters)

Introduction to Randomized Algorithms III

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

Mining of Massive Datasets Jure Leskovec, AnandRajaraman, Jeff Ullman Stanford University

Piazza Recitation session: Review of linear algebra Location: Thursday, April 11, from 3:30-5:20 pm in SIG 134 (here)

15-451/651: Design & Analysis of Algorithms September 13, 2018 Lecture #6: Streaming Algorithms last changed: August 30, 2018

High Dimensional Search Min- Hashing Locality Sensi6ve Hashing

Slide source: Mining of Massive Datasets Jure Leskovec, Anand Rajaraman, Jeff Ullman Stanford University.

The Market-Basket Model. Association Rules. Example. Support. Applications --- (1) Applications --- (2)

Lecture 4: Hashing and Streaming Algorithms

Lecture and notes by: Alessio Guerrieri and Wei Jin Bloom filters and Hashing

Slides credits: Mining of Massive Datasets Jure Leskovec, Anand Rajaraman, Jeff Ullman Stanford University

Frequent Itemsets and Association Rule Mining. Vinay Setty Slides credit:

CS246 Final Exam, Winter 2011

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CSCB63 Winter Week 11 Bloom Filters. Anna Bretscher. March 30, / 13

Bloom Filters and Locality-Sensitive Hashing

Lecture Note 2. 1 Bonferroni Principle. 1.1 Idea. 1.2 Want. Material covered today is from Chapter 1 and chapter 4

Lecture Lecture 25 November 25, 2014

DATA MINING LECTURE 6. Similarity and Distance Sketching, Locality Sensitive Hashing

CS5112: Algorithms and Data Structures for Applications

Lecture 2. Frequency problems

2.6 Complexity Theory for Map-Reduce. Star Joins 2.6. COMPLEXITY THEORY FOR MAP-REDUCE 51

Jeffrey D. Ullman Stanford University

:s ej2mttlm-(iii+j2mlnm )(J21nm/m-lnm/m)

Lecture 3 Sept. 4, 2014

As mentioned, we will relax the conditions of our dictionary data structure. The relaxations we

arxiv: v1 [cs.ds] 3 Feb 2018

Sampling for Frequent Itemset Mining The Power of PAC learning

Counting. 1 Sum Rule. Example 1. Lecture Notes #1 Sept 24, Chris Piech CS 109

Topic 4 Randomized algorithms

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 32

1 Probabilities. 1.1 Basics 1 PROBABILITIES

CS246: Mining Massive Datasets Jure Leskovec, Stanford University.

Lecture 10. Sublinear Time Algorithms (contd) CSC2420 Allan Borodin & Nisarg Shah 1

Knowledge Discovery and Data Mining 1 (VO) ( )

Mining of Massive Datasets Jure Leskovec, AnandRajaraman, Jeff Ullman Stanford University

CS5314 Randomized Algorithms. Lecture 15: Balls, Bins, Random Graphs (Hashing)

Ad Placement Strategies

Lecture 6 September 13, 2016

Kernel-based density. Nuno Vasconcelos ECE Department, UCSD

CS224W: Social and Information Network Analysis Jure Leskovec, Stanford University

Big Data. Big data arises in many forms: Common themes:

8/28/2017. PSY 5101: Advanced Statistics for Psychological and Behavioral Research 1

14.1 Finding frequent elements in stream

Checkpoint Questions Due Monday, October 1 at 2:15 PM Remaining Questions Due Friday, October 5 at 2:15 PM

Statistical Privacy For Privacy Preserving Information Sharing

Data-Intensive Distributed Computing

ECEN 689 Special Topics in Data Science for Communications Networks

CS570 Introduction to Data Mining

1 Estimating Frequency Moments in Streams

Algorithms for Data Science: Lecture on Finding Similar Items

Problem 1: (Chernoff Bounds via Negative Dependence - from MU Ex 5.15)

B669 Sublinear Algorithms for Big Data

Discrete Math, Spring Solutions to Problems V

An Optimal Algorithm for l 1 -Heavy Hitters in Insertion Streams and Related Problems

RAPPOR: Randomized Aggregatable Privacy- Preserving Ordinal Response

Introduction to Algebra: The First Week

1 Maintaining a Dictionary

Lecture 1 September 3, 2013

Most General computer?

Finding Similar Sets. Applications Shingling Minhashing Locality-Sensitive Hashing Distance Measures. Modified from Jeff Ullman

CS 5321: Advanced Algorithms Amortized Analysis of Data Structures. Motivations. Motivation cont d

Independence. CS 109 Lecture 5 April 6th, 2016

Learning Theory. Machine Learning CSE546 Carlos Guestrin University of Washington. November 25, Carlos Guestrin

The Growth of Functions. A Practical Introduction with as Little Theory as possible

An Algorithms-based Intro to Machine Learning

Approximate counting: count-min data structure. Problem definition

DATA MINING LECTURE 3. Frequent Itemsets Association Rules

A General-Purpose Counting Filter: Making Every Bit Count. Prashant Pandey, Michael A. Bender, Rob Johnson, Rob Patro Stony Brook University, NY

1 Probabilities. 1.1 Basics 1 PROBABILITIES

COMPUTING SIMILARITY BETWEEN DOCUMENTS (OR ITEMS) This part is to a large extent based on slides obtained from

CS174 Final Exam Solutions Spring 2001 J. Canny May 16

How Philippe Flipped Coins to Count Data

Part 1: Hashing and Its Many Applications

Solutions to COMP9334 Week 8 Sample Problems

N/4 + N/2 + N = 2N 2.

Discrete probability distributions

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Continuous-Valued Probability Review

CS 188: Artificial Intelligence Fall 2008

General Naïve Bayes. CS 188: Artificial Intelligence Fall Example: Overfitting. Example: OCR. Example: Spam Filtering. Example: Spam Filtering

Algorithms for Data Science

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

SUMMARIZING MEASURED DATA. Gaia Maselli

Interesting Patterns. Jilles Vreeken. 15 May 2015

We introduce one more operation on sets, perhaps the most important

CS425: Algorithms for Web Scale Data

Associa'on Rule Mining

Aberrant Behavior Detection in Time Series for Monitoring Business-Critical Metrics (DRAFT)

Transcription:

CS341 info session is on Thu 3/1 5pm in Gates415 CS246: Mining Massive Datasets Jure Leskovec, Stanford University http://cs246.stanford.edu

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 2 More algorithms for streams: (1) Filtering a data stream: Bloom filters Select elements with property x from stream (2) Counting distinct elements: Flajolet-Martin Number of distinct elements in the last k elements of the stream (3) Estimating moments: AMS method Estimate std. dev. of last k elements (4) Counting frequent items

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 4 Each element of data stream is a tuple Given a list of keys S Determine which tuples of stream are in S Obvious solution: Hash table But suppose we do not have enough memory to store all of S in a hash table E.g., we might be processing millions of filters on the same stream

Example: Email spam filtering We know 1 billion good email addresses Or, each user has a list of trusted addresses If an email comes from one of these, it is NOT spam Publish-subscribe systems You are collecting lots of messages (news articles) People express interest in certain sets of keywords Determine whether each message matches user s interest Content filtering: You want to make sure the user does not see the same ad multiple times 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 5

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 6 Given a set of keys S that we want to filter Create a bit array B of n bits, initially all 0s Choose a hash function h with range [0,n) Hash each member of sî S to one of n buckets, and set that bit to 1, i.e., B[h(s)]=1 Hash each element a of the stream and output only those that hash to bit that was set to 1 Output a if B[h(a)] == 1

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 7 Item Filter Output the item since it may be in S. Item hashes to a bucket that at least one of the items in S hashed to. Hash func h 0010001011000 Bit array B Drop the item. It hashes to a bucket set to 0 so it is surely not in S. Creates false positives but no false negatives If the item is in S we surely output it, if not we may still output it

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 8 S = 1 billion email addresses B = 1GB = 8 billion bits If the email address is in S, then it surely hashes to a bucket that has the big set to 1, so it always gets through (no false negatives) Approximately 1/8 of the bits are set to 1, so about 1/8 th of the addresses not in S get through to the output (false positives) Actually, less than 1/8 th, because more than one address might hash to the same bit

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 9 More accurate analysis for the number of false positives Consider: If we throw m darts into n equally likely targets, what is the probability that a target gets at least one dart? In our case: Targets = bits/buckets Darts = hash values of items

We have m darts, n targets What is the probability that a target gets at least one dart? Equals 1/e as n Equivalent 1 - (1 1/n) n( m / n) 1 e m/n Probability some target X not hit by a dart Probability at least one dart hits target X 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu Approximation is especially accurate when n is large 10

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 11 Fraction of 1s in the array B = = probability of false positive = 1 e -m/n Example: 10 9 darts, 8 10 9 targets Fraction of 1s in B = 1 e -1/8 = 0.1175 Compare with our earlier estimate: 1/8 = 0.125

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 12 Consider: S = m, B = n Use k independent hash functions h 1,, h k Initialization: Set B to all 0s Hash each element sî S using each hash function h i, set B[h i (s)] = 1 (for each i = 1,.., k) Run-time: When a stream element with key x arrives If B[h i (x)] = 1 for all i = 1,..., k then declare that x is in S That is, x hashes to a bucket set to 1 for every hash function h i (x) Otherwise discard the element x (note: we have a single array B!)

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 13 What fraction of the bit vector B are 1s? Throwing k m darts at n targets So fraction of 1s is (1 e -km/n ) But we have k independent hash functions and we only let the element x through if all k hash element x to a bucket of value 1 So, false positive probability = (1 e -km/n ) k

m = 1 billion, n = 8 billion k = 1: (1 e -1/8 ) = 0.1175 k = 2: (1 e -1/4 ) 2 = 0.0493 What happens as we keep increasing k? Optimal value of k: n/m ln(2) In our case: Optimal k = 8 ln(2) = 5.54 6 Error at k = 6: (1 e -3/4 ) 2 = 0.0216 0.02 0 2 4 6 8 10 12 14 16 18 20 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 14 False positive prob. Optimal k: k which gives the lowest false positive probability 0.2 0.18 0.16 0.14 0.12 0.1 0.08 0.06 0.04 Number of hash functions, k

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 15 Bloom filters guarantee no false negatives, and use limited memory Great for pre-processing before more expensive checks Suitable for hardware implementation Hash function computations can be parallelized Is it better to have 1 big B or k small Bs? It is the same: (1 e -km/n ) k vs. (1 e -m/(n/k) ) k But keeping 1 big B is simpler

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 17 Problem: Data stream consists of a universe 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 so far That is, keep a hash table of all the distinct elements seen so far

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 18 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? How many distinct products have we sold in the last week?

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 19 Real problem: What if we do not have space to maintain the set of elements seen so far? Estimate the count in an unbiased way Accept that the count may have a little error, but limit the probability that the error is large

Estimated number of distinct elements = 2 R 20 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 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 0s in h(a) r(a) = position of first 1 counting from the right E.g., say h(a) = 12, then 12 is 1100 in binary, so r(a) = 2 Record R = the maximum r(a) seen R = max a r(a), over all the items a seen so far

Very very rough and heuristic intuition why Flajolet-Martin works: h(a) hashes a with equal prob. to any of N values Then h(a) is a sequence of log 2 N bits, where 2 -r fraction of all as have a tail of r zeros About 50% of as hash to ***0 About 25% of as hash to **00 So, if we saw the longest tail of r=2 (i.e., item hash ending *100) then we have probably seen about 4 distinct items so far So, it takes to hash about 2 r items before we see one with zero-suffix of length r 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 21

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 22 Now we show why Flajolet-Martin works Formally, we will show that probability of finding a tail of r zeros: Goes to 1 if! # $ Goes to 0 if! # $ where! is the number of distinct elements seen so far in the stream Thus, 2 R will almost always be around m!

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 23 What is the probability that a given h(a) ends in at least r zeros? It is 2 -r h(a) hashes elements uniformly at random Probability that a random number ends in at least r zeros is 2 -r Then, the probability of NOT seeing a tail of length r among m elements:! # $% & Prob. all end in fewer than r zeros. Prob. that given h(a) ends in fewer than r zeros

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 24 r -r -r -r m -r 2 ( m2 ) -m2 Note: (1-2 ) = (1-2 )» e Prob. of NOT finding a tail of length r is: If m << 2 r, then prob. tends to 1 (1-2 -r ) m» e -m2 = 1 as m/2 r 0 So, the probability of finding a tail of length r tends to 0 If m >> 2 r, then prob. tends to 0 (1-2 -r ) m» e -m2 -r -r = as m/2 r So, the probability of finding a tail of length r tends to 1 Thus, 2 R will almost always be around m! 0

E[2 R ] is actually infinite Probability halves when R R+1, but value doubles Workaround involves using many hash functions h i and getting many samples of R i How are samples R i combined? Average? What if one very large value! " #? Median? All estimates are a power of 2 Solution: Partition your samples into small groups Take the median of groups Then take the average of the medians 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 25

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 26

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 27 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 å iîa (m ) i k This is the same way as moments are defined in statistics. But there we many times center the moment by subtracting the mean

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 28 å iîa (m ) 0 th moment = number of distinct elements The problem just considered 1 st moment = count of the numbers of elements = length of the stream Easy to compute 2 nd moment = surprise number S = a measure of how uneven the distribution is i k

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 29 Third Moment is Skew: Fourth moment: Kurtosis peakedness (width of peak), tail weight, and lack of shoulders (distribution primarily peak and tails, not in between).

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 30 Stream of length 100 11 distinct values Item counts: 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 Surprise S = 910 Item counts: 90, 1, 1, 1, 1, 1, 1, 1,1, 1, 1 Surprise S = 8,110

[Alon, Matias, and Szegedy] 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 31 AMS method works for all moments Gives an unbiased estimate We will just concentrate on the 2 nd moment S We pick and keep track of many variables X: For each variable X we store X.el and X.val X.el corresponds to the item i X.val corresponds to the count! " of item i Note this requires a count in main memory, so number of Xs is limited Our goal is to compute # = & ' ( '

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 32 How to set X.val and X.el? Assume stream has length n (we relax this later) Pick some random time t (t<n) to start, so that any time is equally likely Let at time t the stream have item i. We set X.el = i Then we maintain count c (X.val = c) of the number of is in the stream starting from the chosen time t Then the estimate of the 2 nd moment ( " # $ # ) is: % = '()) =, ($. 0) Note, we will keep track of multiple Xs, (X 1, X 2, X k ) 2 and our final estimate will be % = 0/2 '() 3 ) 3

3/1/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 33 Count: 1 2 1 2 3 m a Stream: a a b b b a b a 2 nd moment is! = $ % & % c t number of times item at time t appears from time t onwards (c 1 =m a, c 2 =m a -1, c 3 =m b ) ' ((*) =, - -(&. - /1, /,) =, - - (, + 4 + 5 + + &$ %,) % m i total count of item i in the stream (we are assuming stream has length n) Group times by the value seen Time t when the last i is seen (c t =1) Time t when the penultimate i is seen (c t =2) Time t when the first i is seen (c t =m i )

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 34 Count: 1 2 3 m a Stream: a a b b b a b a! "($) = ' ( * (1 + 3 + 5 + + 22 3 1) 3 Little side calculation: 1 + 3 + 5 + + 22 3 1 = 6 7 38' (25 1) = 2 6 7 6 7 9' 2 3 = (2 3 ) : Then ; <(=) = >?? @ A B A : So, C D(E) = @ B A A = F We have the second moment (in expectation)!

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 35 For estimating k th moment we essentially use the same algorithm but change the estimate: For k=2 we used n (2 c 1) For k=3 we use: n (3 c 2 3c + 1) (where c=x.val) Why? For k=2: Remember we had 1 + 3 + 5 + + 2' ( 1 and we showed terms 2c-1 (for c=1,,m) sum to m 2, -./ 2+ 1 =, -./ + 1, + 1 1 = So: 23 4 = 3 2 3 4 2 -./ ' 1 For k=3: c 3 - (c-1) 3 = 3c 2-3c + 1 Generally: Estimate = 5 (+ 8 + 1 8 )

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 36 In practice: Compute!(#) = '(( ) +) for as many variables X as you can fit in memory Average them in groups Take median of averages Problem: Streams never end We assumed there was a number n, the number of positions in the stream But real streams go on forever, so n is a variable the number of inputs seen so far

(1) The variables X have n as a factor keep n separately; just hold the count in X (2) Suppose we can only store k counts. We must throw some Xs out as time goes on: Objective: Each starting time t is selected with probability k/n Solution: (fixed-size sampling!) Choose the first k times for k variables When the n th element arrives (n > k), choose it with probability k/n If you choose it, throw one of the previously stored variables X out, with equal probability 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 37

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 38

N 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 39 New Problem: Given a stream, which items appear more than s times in the window? Possible solution: Think of the stream of baskets as one binary stream per item 1 = item present; 0 = not present Use DGIM to estimate counts of 1s for all items At least 1 of size 16. Partially beyond window. 2 of size 8 2 of size 4 1 of size 2 2 of size 1 1001010110001011010101010101011010101010101110101010111010100010110010

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 40 In principle, you could count frequent pairs or even larger sets the same way One stream per itemset Drawbacks: Only approximate Number of itemsets is way too big

Exponentially decaying windows: A heuristic for selecting likely frequent item(sets) What are currently most popular movies? Instead of computing the raw count in last N elements Compute a smooth aggregation over the whole stream If stream is a 1, a 2, and we are taking the sum of the stream, take the answer at time t to be: ( = $*% # $ % ' ()$ c is a constant, presumably tiny, like 10-6 or 10-9 When new a t+1 arrives: Multiply current sum by (1-c) and add a t+1 2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 41

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 42 If each a i is an item we can compute the characteristic function of each possible item x as an Exponentially Decaying Window That is: ( #*% " # % ' ()# where δ i =1 if a i =x, and 0 otherwise Imagine that for each item x we have a binary stream (1 if x appears, 0 if x does not appear) New item x arrives: Multiply all counts by (1-c) Add +1 to count for element x Call this sum the weight of item x

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 43... 1/c Important property: Sum over all weights " $ % % is 1/[1 (1 c)] = 1/c

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 44 What are currently most popular movies? Suppose we want to find movies of weight > ½ Important property: Sum over all weights % 1 $ % is 1/[1 (1 c)] = 1/c Thus: There cannot be more than 2/c movies with weight of ½ or more So, 2/c is a limit on the number of movies being counted at any time

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 45 Count (some) itemsets in an E.D.W. What are currently hot itemsets? Problem: Too many itemsets to keep counts of all of them in memory When a basket B comes in: Multiply all counts by (1-c) For uncounted items in B, create new count Add 1 to count of any item in B and to any itemset contained in B that is already being counted Drop counts < ½ Initiate new counts (next slide)

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 46 Start a count for an itemset S B if every proper subset of S had a count prior to arrival of basket B Intuitively: If all subsets of S are being counted this means they are frequent/hot and thus S has a potential to be hot Example: Start counting S={i, j} iff both i and j were counted prior to seeing B Start counting S={i, j, k} iff {i, j}, {i, k}, and {j, k} were all counted prior to seeing B

2/28/18 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu 47 Counts for single items < (2/c) (avg. number of items in a basket) Counts for larger itemsets =?? But we are conservative about starting counts of large sets If we counted every set we saw, one basket of 20 items would initiate 1M counts