当前位置:网站首页>Bloom filter
Bloom filter
2022-06-30 09:41:00 【Zip-List】
The bloon filter
Definition
The bloon filter is ⼀ A probabilistic data structure , It is characterized by ⾼ Effective insert ⼊ and Inquire about , Can clearly tell a string ⼀ Must not exist perhaps Possible ;
Bloom filter phase ⽐ Traditional query structure ( for example : hash, set, map And so on ) more ⾼ effect , Occupy ⽤ More space ⼩; But the drawback is that it returns The result is probability Of , That is to say, there are errors in the results , Although this error is controllable ; At the same time, it No ⽀ Hold delete operation ;
form
Bitmap (bit Array ) + n individual hash function
principle
When ⼀ Elements plus ⼊ Bitmap time , adopt k individual hash Function maps this element to the of the bitmap k A little bit , And set them as
1; When retrieving , Re pass k individual hash Function operation to detect the of bitmap k Whether all points are 1; If there is any reason not to 1 The point of , So think
non-existent ; If it's all 1, There may be ( There is an error );
There are only two states for each slot in the bitmap (0 perhaps 1),⼀ Slots are set to 1 state , But it is not clear how many times it has been set ; I don't know how many str1 Hash mapping and which hash Function mapping ; So don't ⽀ Hold the delete operation ;
In practice, we should ⽤ In the process , How the bloom filter makes ⽤? How many hash function , Bitmap of how much space to allocate , How many elements are stored ? In addition, how to control the false positive rate ( The bloan filter can define ⼀ Must not exist , Not clear ⼀ There must be , Then there is an error in the judgment of existence , False positive rate is the probability of wrong judgment )?
In practice, we should ⽤ in , We are sure that n and p, Pass on ⾯ The calculation of m and k; It can also be in ⽹ Select the appropriate value on the station :
https://hur.st/bloomfilterIt is known that k, How to choose k individual hash function ?
// Mining ⽤⼀ individual hash function , to hash Pass on different species ⼦ Offset value
// #define MIX_UINT64(v) ((uint32_t)((v>>32)^(v)))
uint64_t hash1 = MurmurHash2_x64(key, len, Seed);
uint64_t hash2 = MurmurHash2_x64(key, len, MIX_UINT64(hash1));
for (i = 0; i < k; i++) // k yes hash Number of functions
{
Pos[i] = (hash1 + i*hash2) % m; // m It's a bitmap ⼤⼩
}
// Through this kind of ⽅ To simulate k individual hash function Before us ⾯ Open addressing double hash yes ⼀ What kind of thinking
边栏推荐
- Using OpenCV Net for image restoration
- Tclistener server and tcpclient client use -- socket listening server and socketclient use
- OCX child thread cannot trigger event event (forward)
- About MySQL Boolean and tinyint (1)
- Train an image classifier demo in pytorch [learning notes]
- MCU firmware packaging Script Software
- Summary of Android knowledge points and common interview questions
- MySQL index optimization miscellaneous
- Deberta (decoding enhanced Bert with distinguished attention)
- Design of mfc+mysql document data management system based on VS2010
猜你喜欢
Xlnet (generalized autorefressive trainingfor language understanding) paper notes
2021-10-20
I once met a girl whom I most wanted to take care of all my life. Later... No later
Handwriting sorter component
Baidu map JS browsing terminal
Idea shortcut key settings
Express file upload
近期学习遇到的比较问题
Dart 开发技巧
Express - static resource request
随机推荐
UltraEdit delete empty line method
8.8 heap insertion and deletion
Generate directory in markdown
Splice and slice functions of JS
Deep Learning with Pytorch - autograd
7. know JNI and NDK
11.自定义hooks
Redis + MySQL implements the like function
ABAP-时间函数
Pass anonymous function to simplification principle
What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?
Solution to pychart's failure in importing torch package
POJ 1753 flip game (DFS 𞓜 bit operation)
MySQL优化
2021-10-20
MySQL explain
Create thread pool demo
基于Svelte3.x桌面端UI组件库Svelte UI
Self service terminal development process
Cftpconnection:: getfile() download FTP server files and related parameter descriptions