# Learning From Data – A Short Course: Exercise 1.10

Page 23, Exercise 1.10

Here is an experiment that illustrates the difference between a single bin and multiple bins. Run a computer simulation for flipping 1,000 fair coins. Flip each coin independently 10 times. Let’s focus on 3 coins as follows: is the first coin flipped; is a coin you choose at random ; is the coin that had the minimum frequency of heads (pick the earlier one in case of a tie). Let , , be the fraction of heads you obtain for the respective three coins.

- What is for the three coins selected?
- Repeat this entire experiment a large number of times (e.g., 100,000 runs of the entire experiment) to get several instances of , and and plot the histograms of the distribution of , and . Notice that which coins end up being and may differ from one run to another.
- Using (b), plot estimates for as a function of , together with the Hoeffding bound (on the same graph).
- Which coins obey the Hoeffding bound, and which ones do not? Explain why.
- Relate part (d) to the multiple bins in Figure 1.10.

Let’s make a correspondence here:

- corresponds to fraction of heads you obtain in a sample of 10 coin flips of type .
- corresponds to fraction of heads you obtain in the (imaginarily unknown) “bin” of coin flips of type – which is the probability of getting head when flipping a coin of type .

, and are all fair coins so it should be .

Look at the plot here and read the dicussions [1] [2]. Here is my guess: Because 1,000 coins all share the same and any two flips of one coin are independent from each other, and any two flips of two coins are also independent from each other, and the event a coin is randomly selected is independently from its flip result, so can be treated as a specific coin. Hence the distribution of and is the same and it is binomial distribution. However, has the different distribution and it is not binomial.

For example:

(*)

while:

You can see the correspondence of (*) and the example in the Lecture 02’s video. You can also generalize the result above. Also please notice that if we use Hoeffding Inequality on the , we have this probability: , which contrasts the fact that , or maybe… we can’t apply Hoeffding Inequality on the ?

We also have the following correspondence:

- One coin flip corresponds one marble.
- A sample of 10 coin flips corresponds a sample of 10 marbles.
- Each coin has its own imaginary bin.
- 100,000 runs of the entire experiment corresponds 100,000 times picking marbles from 1,000 bins with 10 marbles each bin.

**Takeaway point:** Probability is based on the information that we have got. In case of the hypothesis set, hypothesis is chosen based on training set and learning algorithm. However, in our theoretical analysis so far, we do not consider any specific of the training set nor of the learning algorithm so the only information we have is: the final hypothesis is one of the hypotheses in the hypothesis set, hence the factor in .

What we have:

What we want to know:

And we know that can be or or … or , so: