Balls-into-Bins Model and Chernoff Bounds
Advanced Algorithms Nanjing University, Fall 2018
Balls-into-Bins Model and Chernoff Bounds Advanced Algorithms - - PowerPoint PPT Presentation
Balls-into-Bins Model and Chernoff Bounds Advanced Algorithms Nanjing University, Fall 2018 Balls-into-Bins Model m balls Balls-into-Bins Model m balls n bins Balls-into-Bins Model m balls uniformly and independently thrown into n bins
Advanced Algorithms Nanjing University, Fall 2018
m balls
m balls n bins
m balls n bins uniformly and independently thrown into
m balls n bins uniformly and independently thrown into uniformly at random choose h: [m]→[n]
m balls n bins uniformly and independently thrown into uniformly at random choose h: [m]→[n] Question: probability that each ball lands in its own bin (h is 1-1)?
m balls n bins uniformly and independently thrown into uniformly at random choose h: [m]→[n] Question: probability that each ball lands in its own bin (h is 1-1)? Question: probability that every bin is not empty (h is onto)?
m balls n bins uniformly and independently thrown into uniformly at random choose h: [m]→[n] Question: probability that each ball lands in its own bin (h is 1-1)? Question: probability that every bin is not empty (h is onto)? Question: maximum number of balls in a bin (max{|h-1(i)|})?
Question: probability that each ball lands in its own bin (h is 1-1)?
Question: probability that each ball lands in its own bin (h is 1-1)?
Question: probability that each ball lands in its own bin (h is 1-1)?
Jan 1st Jan 2nd Jan 3rd Jan 31st Feb 1st
Dec 31st
Question: probability that each ball lands in its own bin (h is 1-1)?
Jan 1st Jan 2nd Jan 3rd Jan 31st Feb 1st
Dec 31st
Question: probability that each ball lands in its own bin (h is 1-1)?
Jan 1st Jan 2nd Jan 3rd Jan 31st Feb 1st
Dec 31st
This probability is some constant when
Question: probability that every bin is not empty (h is onto)?
Question: probability that every bin is not empty (h is onto)?
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Let Xi be the number of balls thrown until i bins are non-empty, given i-1 bins are already non-empty.
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Let Xi be the number of balls thrown until i bins are non-empty, given i-1 bins are already non-empty. Xi is a geometric r.v. with parameter (n-i+1)/n.
Question: probability that every bin is not empty (h is onto)? Question: how many balls we need to throw to leave no empty bins?
Let Xi be the number of balls thrown until i bins are non-empty, given i-1 bins are already non-empty. Xi is a geometric r.v. with parameter (n-i+1)/n.
Question: maximum number of balls in a bin (max{|h-1(i)|})?
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|.
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|.
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|. Let Yij be i.r.v. taking value 1 iff ball j lands in bin i.
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|. Let Yij be i.r.v. taking value 1 iff ball j lands in bin i.
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|. Let Yij be i.r.v. taking value 1 iff ball j lands in bin i. Is max{𝔽(Xi)} what we want?
Question: maximum number of balls in a bin (max{|h-1(i)|})? Let Xi be the number of balls in bin i. That is, Xi = |h-1(i)|. Let Yij be i.r.v. taking value 1 iff ball j lands in bin i. Is max{𝔽(Xi)} what we want? For every i, 𝔽(Xi) is m/n, so max{𝔽(Xi)} is simply m/n.
Question: maximum number of balls in a bin?
Question: maximum number of balls in a bin?
Question: maximum number of balls in a bin? Something is not right…
Question: maximum number of balls in a bin?
with high probability (w.h.p.): We say an event happens with high probability (with respect to n) if it happens with probability at least 1-1/n.
Question: maximum number of balls in a bin?
let m=n
let t = 3ln(n)/lnln(n)
for sufficiently large n
let m=nlg(n)
let t = 4m/n = 4lg(n)
let t = 4m/n = 4lg(n)
Question: maximum number of balls in a bin (max{|h-1(i)|})? “m balls are thrown into n bins uniformly and independently at random” “uniformly at random choose h: [m]→[n]”
balls into bins coin flipping
balls into bins coin flipping Question: probability that X deviates more than 𝜀 from expectation?
Herman Chernoff
Herman Chernoff
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 p
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 p
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i For 𝑛 = 𝑜, 𝜈 = 1 implies
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i For 𝑛 = 𝑜, 𝜈 = 1 implies when 𝑢 ≥
𝑓 ln 𝑜 ln ln 𝑜 and 𝑜 sufficiently large
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i For 𝑛 = 𝑜, 𝜈 = 1 implies when 𝑢 ≥
𝑓 ln 𝑜 ln ln 𝑜 and 𝑜 sufficiently large
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
Xi: load of bin i Yij: i.r.v. taking value 1 iff ball j lands in bin i For 𝑛 = 𝑜, 𝜈 = 1 implies when 𝑢 ≥
𝑓 ln 𝑜 ln ln 𝑜 and 𝑜 sufficiently large
when 𝑛 = Θ(𝑜) max load is 𝑃
log 𝑜 log log 𝑜 w.h.p.
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜 when 𝑛 = Ω(𝑜 log 𝑜) max load is 𝑃
𝑛 𝑜
w.h.p.
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜 when 𝑛 = Ω(𝑜 log 𝑜) max load is 𝑃
𝑛 𝑜
w.h.p.
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
For 𝑛 ≥ 𝑜 ln 𝑜, 𝜈 ≥ ln 𝑜 when 𝑛 = Ω(𝑜 log 𝑜) max load is 𝑃
𝑛 𝑜
w.h.p. when 𝑛 = Ω(𝑜 log 𝑜) min load is Ω
𝑛 𝑜
w.h.p.
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
“m balls are thrown into n bins uniformly and independently at random” Question: maximum number of balls in a bin?
by Taylor’s expansion:
𝜇 > 0, and generalized Markov’s inequality
𝜇 > 0, and generalized Markov’s inequality
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧 minimized when 𝜇 = ln(1 + 𝜀)
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧 minimized when 𝜇 = ln(1 + 𝜀)
(a) apply Markov’s inequality to moment generating function
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧 minimized when 𝜇 = ln(1 + 𝜀)
(a) apply Markov’s inequality to moment generating function (b) bound the value of the moment generating function
𝜇 > 0, and generalized Markov’s inequality independence of Xi not linearity of expectation 1 + 𝑧 ≤ 𝑓𝑧 minimized when 𝜇 = ln(1 + 𝜀)
(a) apply Markov’s inequality to moment generating function (b) bound the value of the moment generating function (c) optimize the bound of the moment generating function
𝜇 > 0, and generalized Markov’s inequality
𝜇 > 0, and generalized Markov’s inequality independence of Yi
𝜇 > 0, and generalized Markov’s inequality independence of Yi Hoeffding’s lemma
𝜇 > 0, and generalized Markov’s inequality independence of Yi Hoeffding’s lemma
𝜇 > 0, and generalized Markov’s inequality independence of Yi Hoeffding’s lemma minimized when 𝜇 =
4𝑢 σ𝑗=1
𝑜
𝑐𝑗−𝑏𝑗 2
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
sort n distinct elements using QuickSort choose pivot uniformly at random in each recursive call of QuickSort
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
sort n distinct elements using QuickSort choose pivot uniformly at random in each recursive call of QuickSort expected cost under adversarial input: Θ(𝑜 log 𝑜)
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
sort n distinct elements using QuickSort choose pivot uniformly at random in each recursive call of QuickSort expected cost under adversarial input: Θ(𝑜 log 𝑜) worst case cost under any input: Θ(𝑜2)
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
sort n distinct elements using QuickSort choose pivot uniformly at random in each recursive call of QuickSort expected cost under adversarial input: Θ(𝑜 log 𝑜) worst case cost under any input: Θ(𝑜2)
Question: probability that cost is 𝜕(𝑜 log 𝑜)?
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
???
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
1 7 2 3 B 5 9 C 4 8 A 6 B 9 C 8 A 1 2 3 4 5 6 1 2 4 5 6 9 8 B C 4 6 1 9 C
Question: probability that cost is 𝜕(𝑜 log 𝑜)? The cost will be at most 30𝑜 lg 𝑜 with high probability.
Question: probability that X deviates more than 𝜀 from expectation?
Question: probability that X deviates more than 𝜀 from expectation?
Question: maximum number of balls in a bin? “m balls are thrown into n bins uniformly and independently at random”
previous strategy new strategy
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin”
Question: maximum number of balls in a bin? “m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin”
Question: maximum number of balls in a bin? “m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” Ο
log 𝑜 log log 𝑜 versus Ο log log 𝑜 , exponential gap
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose two bins uniformly and independently at random, then place the ball in the less loaded bin” the max loaded bin has Ο(log log 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose 𝑒 ≥ 2 bins uniformly and independently at random, then place the ball in the least loaded bin”
“m balls are thrown into n bins in the following manner: for each ball, choose 𝑒 ≥ 2 bins uniformly and independently at random, then place the ball in the least loaded bin” the max loaded bin has Ο(log(𝑒) 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose 𝑒 ≥ 2 bins uniformly and independently at random, then place the ball in the least loaded bin” the max loaded bin has Ο(log(𝑒) 𝑜) balls, w.h.p.
“m balls are thrown into n bins in the following manner: for each ball, choose 𝑒 ≥ 2 bins uniformly and independently at random, then place the ball in the least loaded bin” the max loaded bin has Ο(log(𝑒) 𝑜) balls, w.h.p. the max loaded bin has Ο
log log 𝑜 log 𝑒
balls, w.h.p.