Calculation of the approximate population of the flower filter

For a flowering filter of dimensional N-bits and x hash functions from which the M-bits (where M <= N) of the filter are set.

Is it possible to approximate the number of elements inserted in a color filter?

Simple example

I reflected on the following example, assuming a BF of 100-bit and 5 hash functions where 10 bits are set ...

Best scenario: Assuming that the hash functions are really perfect and unambiguously display a bit for a number of X values, then the given 10-bits were set, we can say that there were only two elements in BF

In the worst case: Assuming that the hash functions are bad and are consistently mapped to the same bit (but unique to each other), we can say that in BF

10 items have been added,

The range is apparently [2,10], where the values ​​in this range are probably determined by the false positive probability of the filter - I am stuck at this point.

+5
source share
2 answers

This question bothers me a bit, because the best algorithms for roughly counting the number of individual elements with a small amount of memory.

, , , - ( " ", ). : , M N , ? B - , ; B/K, K.

- ; . 1 , , λ Pr(Exponential[λ] < 1) = M/N, 1 - exp(-λ) = M/N λ = -log(1 - M/N). λ , B ≈ -N log(1 - M/N)/K.

: N , N.

+10

Wikipedia , - , , - , 1 - (1-1/m)^kn. m , , / m(1-(1-1/m)^kn). n, n, .

, , , . , - . , Var(X) = E(X^2) - E(X)^2. E(X^2) , , , , " 0 1, " " 0 ", " , 0 1, ".

0

All Articles