Let X be a Bernoulli random variable with unknown probability
P[X=1]P[X=0]=μ.=1−μ
where n1≤μ≤1 for some integer n>0. The goal is to estimate μ (denoted by μ~) via sampling.
By law of large number, μ~ converges to μ when we sample enough numbers of X. The convergence behavior is captured by Chernoff inequality and O(δ2μ1logpfail1) samples are needed to get an estimation μ~ such that P[μ~∈(1±δ)μ]≥1−pfail (See Exercise 1). Such an μ~ is called an (δ,pfail)-estimation of μ.
As μ≥n1, O(δ2nlogpfail1) samples are enough. The problem is, if μ is much larger than 1/n, we waste a lot of samples. E.g., when n=1000 and μ=21, δ2μ1logpfail1 gives us δ22logpfail1 while δ2nlogpfail1 equals to δ21000logpfail1.
Can we obtain an (δ,pfail)-estimation μ~ with just O(δ2μ1logpfail1) samples, even though μ itself is unknown?
Yes we can (with the lost of a factor loglogn, which is almost negligible). First we relax the goal a little bit -- finding a μ~∈[μ/2,2μ] instead of a μ~∈(1±δ)μ. We show how to achieve this with O(μ1logpfaillogn) samples.
The high level idea is to divide [n1,1] into a set of intervals
Let [2j1,2j−11](j∈N) be the interval that u belongs to.
Given an integer i, such that i≤j−2 or i≥j+1, we can determine whether μ≥2i1 with high probability. We generate O(2ilogpfaillogn) samples and test whether their average (i.e., μ~) is greater than 2i1. If μ~>2i1, by Chernoff inequality, μ>2i1 with high probability and the test returns true.
To search for the interval [2j1,2j−11] that μ belongs to, we perform the test for increasing values of i=1,2,... until we find the first i, such that the test for μ≥2i1 returns true. We claim that with high probability, i takes one of the following values: {j−1,j,j+1}. The reason is that the test returns false (with high probability) when i≤j−2. The results for i=j−1 and j are undetermined. Even if the test fails to return true for both i=j−1 and j, it returns true for i=j+1 with high probability.
Finally, after we find an i∈{j−1,j,j+1}, we know that μ≥2⋅2i1. Therefore, O(2ilogpfaillogn) samples gives an (δ,pfail)-estimate of μ.
Then the total number of samples we generate is at most:
It follows that by union bound the test fails for all i=1,2,...,j−2,j+1 is at most lognpfail⋅(j−1)≤pfail.
Exercise
Given a Bernoulli random variable X with mean μ, prove that (with Chernoff bound) if we generate Ω(δ2μ1logpfail1) independent samples, we get an estimate of X with relative error δ with probability 1−pfail.
Reference:
Tang Youze, Xiaokui Xiao, and Yanchen Shi. "Influence maximization: Near-optimal time complexity meets practical efficiency." Proceedings of the 2014 ACM SIGMOD international conference on Management of data. ACM, 2014.