Monte Carlo integration It is a numerical probabilistic
Monte Carlo integration It is a numerical probabilistic algorithm f I/(b-a) a Prabhas Chongstitvatana b 1
MCint(f, n, a, b) sum = 0 I/(b-a) For i = 1 to n do x = uniform(a, b) b-a sum = sum + f(x) Return ( b-a) * (sum/n) Prabhas Chongstitvatana 2
Variance of the estimate is inverse proportion to n The expected error is proportion to A deterministic algorithm for integration will sample at regular interval. Prabhas Chongstitvatana 3
DETint(f, n, a, b) sum = 0 delta = (b-a)/n x = a + delta/2 For I = 1 to n do sum = sum + f(x) x = x + delta Return sum * delta Prabhas Chongstitvatana 4
Advantage of MCint when doing multiple integral in high dimension. As the sample point increases exponentially with the dimension. Example 100, 100 x 100. MCint is faster than a deterministic algorithm for dimension >= 4. Prabhas Chongstitvatana 5
Probabilistic counting A n-bit register can count up to 2 n events (0. . 2 n-1) init(c) ; reset tick(c) ; increment count(c) ; return count value Skip some value to count farther Prabhas Chongstitvatana 6
tick(c) flip a coin if head increment count(c) return value x 2 Expected value after call count() t time is exactly t. Prabhas Chongstitvatana 7
tick(c) flip a coin if head increment count(c) return value x 2 Expected value after call count() t time is exactly t. Count exponentially farther (8 -bit count more than 5 x 1076 events) count(c) return 2 c – 1 Prabhas Chongstitvatana 8
Estimate number of tick 2 c+1 – 1 with probability p 2 c – 1 with prob. (1 - p) Expected value (2 c+1 – 1 ) p + (2 c – 1 ) ( 1 – p ) = 2 c + 2 c p – 1 p = 2 -c will get the correct expected value of count(c) Prabhas Chongstitvatana 9
init(c) c=0 tick(c) For i = 1 to c do if coinflip = head then return c=c+1 count(c) Return 2 c – 1 Prabhas Chongstitvatana 10
Variance of count after m ticks is m(m-1)/2. The standard deviation is 70%. This means it cannot distinguish between one million and two million but it can distinguish between one million and 100 million. Prabhas Chongstitvatana 11
Count logarithmic farther count(c) = when e is small e = 1/30 count up to > 125000 events in 8 -bit register with less than 24% relative error with confidence 95%. What is probability that tick(c) increment ? Prabhas Chongstitvatana 12
- Slides: 12