+ All Categories
Home > Documents > Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in...

Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in...

Date post: 26-Jun-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
20
Bloom Filter & Hashing Barna Saha
Transcript
Page 1: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

BloomFilter&Hashing

BarnaSaha

Page 2: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

BloomFilter

•  ChecksforSETMEMBERSHIPefficiently

Iselementxintheset?

Page 3: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

MoAvaAngExample

•  SpamFiltering

Ø Wehaveasetof1billionemailaddressesthatweconsidertobenon-spam.Ø  Eachstreamelementisoftheform(emailaddress,email).Ø  BeforeaccepAngtheemail,amail-clientneedstocheckifthisaddressbelongstosetS.Ø  Eachtypicalemailaddressrequires20bytesofstoragewhereasinthemainmemoryweonlyhavesay1billionbyte(roughly1Gigabyte),or8billionbits.Ø Wecannotstoreallthevalidemailaddressesinthemain

memory.

Page 4: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

MoAvaAngExample

•  SpamFiltering– Allvalidemailsmustbedelivered– Numberofspamemailsdeliveredshouldbeaslowaspossible

Page 5: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

BloomFilter

Page 6: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

BloomFilter

Page 7: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

AnalysisofBloomFilter

Page 8: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

AnalysisofBloomFilter

Page 9: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

SpamFilteringExample

•  Wehave

Page 10: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

OpAmumValueofk

•  AsthenumberofhashfuncAonsincrease,higheristhechanceoffindinga0bitcell

•  AlsowithincreasingnumberofhashfuncAons,thenumberofcellswith0bitsdecreases

•  OpAmumvalueobtainedbydifferenAaAon

Page 11: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

ApplicaAonsofBloomFilter

•  BloomFilterhasfoundinnumerableapplicaAonsinnetworkingandwebtechnology

Page 12: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses
Page 13: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses
Page 14: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses
Page 15: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses
Page 16: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses
Page 17: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

AnalysisofBloomFilter

AnalysisusesfullyrandomhashfuncAons—difficulttoobtainwithhighspaceandcompuAngrequirements

Page 18: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

Strongly2-wiseUniversalHashFuncAon

•  MappingsetofkeysU=[0,1,2,…,m-1]torangeR=[0,1,2,…,n-1]– H={ha,b=[(ax+b)modp]modn}

•  p>=misaprime,1<=a<=p-1,0<=b<=p-1•  Easytocomputeandstore:O(1)•  SaAsfies(almost)forall,

Page 19: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

Strongly3-wiseUniversalHashFuncAon

•  MappingsetofkeysU=[0,1,2,…,m-1]torangeR=[0,1,2,…,n-1]– H={ha,b=[(ax2+bx+c)modp]modn}

•  p>=misaprime,1<=a<=p-1,0<=b,c<=p-1•  Easytocomputeandstore:O(1)•  SaAsfies(almost)

Page 20: Bloom Filter & Hashing · Bloom Filter • Checks for SET MEMBERSHIP efficiently Is element x in the set? MoAvang Example • Spam Filtering Ø We have a set of 1 billion email addresses

•  MappingsetofkeysU=[0,1,2,…,p-1]torangeR=[0,1,2,…,p-1]– H={ha,b=(ax+b)modp},0<=a,b<=p-1

•  Fix.– Whatis?– NumberofhashfuncAons– NumberofsoluAonsfor“a”and“b”=1

Strongly2-Universal


Recommended