Docsity

Low Support High Correlation Mining-Distributed Queries-Lecture Notes, Study notes of Distributed Database Management Systems

Toggle sidebar
bg1
3 Low-Support, High-Correlation Mining
We continue to assume a \market-basket" model for data, and we visualize the data as a b oolean matrix,
where rows = baskets and columns = items. Key assumptions:
1. Matrix is very sparse; almost all 0's.
2. The number of columns (items) is suciently small that we can store something per column in main
memory, but suciently large that we cannot store something per pair of items in main memory (same
assumption we've made in all association-rule work so far).
3. The numberofrows is so large that we cannot store the entire matrix in memory,even if we take
advantage of sparseness and compress (again, sames assumption as always).
4. We are not interested in high-support pairs or sets of columns; rather wewant highly correlated pairs
of columns.
3.1 Applications
While marketing applications generally care only about high support (it doesn't pay to try to market things
that nobody buys anyway), there are several applications that meet the model above, especially the point
about pairs of columns/items with low supp ort but high correlation being interesting:
1. Rows and columns are Web pages; (
r;c
) = 1 means that the page of row
r
links to the page of column
c
. Similar columns may be pages about the same topic.
2. Same as (1), but the page of column
c
links to the page of row
r
.Now, similar columns may represent
mirror pages.
3. Rows=Web pages or documents; columns = words. Similar columns are words that appear almost
always together, e.g., \phrases."
4. Same as (3), but rows are sentences. Similar columns may indicate mirror pages or plagiarisms.
3.2 Similarity
Think of a column as the set of rows in which the column has a 1. Then the
similarity
of two columns
C
1
and
C
2
is
Sim
(
C
1
;C
2
)=
j
C
1
\
C
2
j
=
j
C
1
[
C
2
j
.
Example 3.1 :
0 1
1 0
1 1 = 2/5 = 40% similar
0 0
1 1
0 1
2
3.3 Signatures
Key idea: map (\hash") each column
C
to a small amount of data [the
signature
,
Sig
(
C
)] such that:
1.
Sig
(
C
) is small enough that a signature for each column can b e t in main memory.
2. Columns
C
1
and
C
2
are highly similar if and only if
Sig
(
C
1
) and
Sig
(
C
2
) are highly similar. (But note
that we need to dene \similarity" for signatures.)
9
docsity.com
pf3
pf4

Partial preview of the text

Download Low Support High Correlation Mining-Distributed Queries-Lecture Notes and more Study notes Distributed Database Management Systems in PDF only on Docsity!

3 Low-Supp ort, High-Correlation Mining

We continue to assume a \market-basket" mo del for data, and we visualize the data as a b o olean matrix, where rows = baskets and columns = items. Key assumptions:

  1. Matrix is very sparse; almost all 0's.
  2. The numb er of columns (items) is suciently small that we can store something p er column in main memory, but suciently large that we cannot store something p er pair of items in main memory (same assumption we've made in all asso ciation-rule work so far).
  3. The numb er of rows is so large that we cannot store the entire matrix in memory, even if we take advantage of sparseness and compress (again, sames assumption as always).
  4. We are not interested in high-supp ort pairs or sets of columns; rather we want highly correlated pairs of columns.

3.1 Applications

While marketing applications generally care only ab out high supp ort (it do esn't pay to try to market things that nob o dy buys anyway), there are several applications that meet the mo del ab ove, esp ecially the p oint ab out pairs of columns/items with low supp ort but high correlation b eing interesting:

  1. Rows and columns are Web pages; (r; c) = 1 means that the page of row r links to the page of column c. Similar columns may b e pages ab out the same topic.
  2. Same as (1), but the page of column c links to the page of row r. Now, similar columns may represent mirror pages.
  3. Rows = Web pages or do cuments; columns = words. Similar columns are words that app ear almost always together, e.g., \phrases."
  4. Same as (3), but rows are sentences. Similar columns may indicate mirror pages or plagiarisms.

3.2 Similarity

Think of a column as the set of rows in which the column has a 1. Then the similarity of two columns C 1 and C 2 is S im(C 1 ; C 2 ) = jC 1 \ C 2 j=jC 1 [ C 2 j.

Example 3.1 :

0 1 1 0 1 1 = 2/5 = 40% similar 0 0 1 1 0 1

2

3.3 Signatures

Key idea: map (\hash") each column C to a small amount of data [the signature, S ig (C )] such that:

  1. S ig (C ) is small enough that a signature for each column can b e t in main memory.
  2. Columns C 1 and C 2 are highly similar if and only if S ig (C 1 ) and S ig (C 2 ) are highly similar. (But note that we need to de ne \similarity" for signatures.)

An idea that do esn't work: Pick 100 rows at random, and make that string of 100 bits b e the signature for each column. The reason is that the matrix is assumed sparse, so many columns will have an all-0 signature even if they are quite dissimilar. Useful convention: given two columns C 1 and C 2 , we'll refer to rows as b eing of four typ es | a; b; c; d | dep ending on their bits in these columns, as follows:

Typ e C 1 C 2 a 1 1 b 1 0 c 0 1 d 0 0

We'll also use a as \the numb er of rows of typ e a," and so on.

 Note, S im(C 1 ; C 2 ) = a=(a + b + c).

 But since most rows are of typ e d, a selection of, say, 100 random rows will b e all of typ e d, so the similarity of the columns in these 100 rows is not even de ned.

3.4 Min Hashing

Imagine the rows p ermuted randomly in order. \Hash" each column C to h(C ), the numb er of the rst row in which column C has a 1.

 The probability that h(C 1 ) = h(C 2 ) is a=(a + b + c), since the hash values agree if the rst row with a 1 in either column is of typ e a, and they disagree if the rst such row is of typ e b or c. Note this probability is the same as S im(C 1 ; C 2 ).

 If we rep eat the exp eriment, with a new p ermutation of rows a large numb er of times, say 100, we get a signature consisting of 100 row numb ers for each column. The \similarity" of these lists (fraction of p ositions in which they agree) will b e very close to the similarity of the columns.

 Imp ortant trick: we don't actually p ermute the rows, which would take many passes over the entire data. Rather, we read the rows in whatever order, and hash each row using (say) 100 di erent hash functions. For each column we maintain the lowest hash value of a row in which that column has a 1, indep endently for each of the 100 hash functions. After considering all rows, we shall have for each column the rst rows in which the column has 1, if the rows had b een p ermuted in the orders given by each of the 100 hash functions.

3.5 Lo cality-Sensitive Hashing

Problem: we've got signatures for all the columns in main memory, and similar signatures mean similar columns, with high probability, but there still may b e so many columns that doing anything that is quadratic in the numb er of columns, even in main memory, is prohibitive. Locality-sensitive hashing (LSH) is a technique to b e used in main memory for approximating the set of similar column-pairs with a lot less than quadratic work. The goal: in time prop ortional to the numb er of columns, eliminate as p ossible similar pairs the vast ma jority of the column pairs.

  1. Think of the signatures as columns of integers.
  2. Partition the rows of the signatures into bands, say l bands of r rows each.
  3. Hash the columns in each band into buckets. A pair of columns is a candidate-pair if they hash to the same bucket in any band.
  4. After identifying candidates, verify each candidate-pair (Ci ; Cj ) by examining S ig (Ci ) and S ig (Cj ) for similarity.

The argument is that all 100 rows of S ig 1 are in the union. In addition, those rows of S ig 2 that are not rows of S ig 1 are in the union, and the latter set of rows is on average 100 c=(a + c) rows. Thus, the similarity of S ig 1 and S ig 2 is: jS ig 1 \ S ig 2 j jS ig 1 [ S ig 2 j

100 a a+c 100 + (^100) a+cc

a a + 2 c

Note that if c is close to b, then the similarity of the signatures is close to the similarity of the columns, which is a=(a + b + c). In fact, if the columns are very similar, then b and c are b oth small compared to a, and the similarities of the signatures and columns must b e close.

3.7 Ampli cation of 1's (Hamming LSH)

If columns are not sparse, but have ab out 50% 1's, then we don't need min-hashing; a random collection of rows serves as a signature. Hamming LSH constructs a series of matrices, each with half as many rows as the previous, by OR-ing together two consecutive rows from the previous, as in Fig. 5.

OR OR

OR OR

Figure 5: Construction of a series of exp onentially smaller, denser matrices

 There are no more than log n matrices if n is the numb er of rows. The total numb er of rows in all matrices is 2 n, and they can all b e computed with one pass through the original matrix, storing the large ones on disk.

 In each matrix, pro duce as candidate pairs those columns that:

  1. Have a medium density of 1's, say b etween 20% and 80%, and
  2. Are likely to b e similar, based on an LSH test.

 Note that the density range 20{80% guarantees that any two columns that are at least 50% similar will b e considered together in at least one matrix, unless by bad luck their relative densities change due to the OR op eration combining two 1's into one.

 A second pass through the original data con rms which of the candidates are really similar.

 This metho d exploits an idea that can b e useful elsewhere: similar columns have similar numb ers of 1's, so there is no p oint ever comparing columns whose numb ers of 1's are very di erent.