NOTE

This is part of the 3rd homework, titled Probabilistic Inference, for the course Machine Learning (IN2064) in the Winter Semester 2024/25 at TUM.

Problem 8:

Consider a Bernoulli random variable and suppose we have observed occurrences of and occurrences of in a sequence of Bernoulli experiments. We are only interested in the number of occurrences of —we will model this with a Binomial distribution with parameter . A prior distribution for is given by the Beta distribution with parameters . Show that the posterior mean value (not the MAP estimate) of lies between the prior mean of and the maximum likelihood estimate for .

To do this, show that the posterior mean can be written as times the prior mean plus times the maximum likelihood estimate, with . This illustrates the concept of the posterior mean being a compromise between the prior distribution and the maximum likelihood solution.

The probability mass function of the Binomial distribution for some is:

Hint: Identify the posterior distribution. You may then look up the mean rather than computing it.

Solution

Our goal is to show that the posterior mean lies between the prior mean and the maximum likelihood estimate (MLE) . Specifically, we aim to show that:

for some . This illustrates the concept that the posterior mean is a compromise between the prior distribution and the maximum likelihood solution.

We will proceed in the following steps:

  1. Calculating the posterior distribution.
  2. Calculating the mean of the posterior distribution.
  3. Calculating the maximum likelihood estimate (MLE) of .
  4. Expressing the posterior mean as a convex combination of the prior mean and the MLE.

1. Calculating the posterior distribution

First, we recall the forms of the prior distribution and the likelihood function:

  • Prior distribution:
  • Likelihood function:

where represents the observed data (with successes and failures).

Using Bayes’ theorem, the posterior distribution is proportional to the product of the likelihood and the prior:

Substituting the expressions for the likelihood and the prior, we get:

It’s not hard to notice that we arrived at unnormalized form of a Beta distribution with updated parameters. Thanks to our perceptiveness we don’t have to go through the hoops of calculating normalizing constant, as it will be equal to the gamma term in the PDF of Beta distribution. As such we have calculated a posterior distribution:

where:

2. Calculating the mean of the posterior distribution

The mean of a Beta distribution is given by:

Therefore, the posterior mean as given as follows:

3. Calculating the maximum likelihood estimate (MLE)

The maximum likelihood estimate of for the Binomial distribution is the sample proportion:


4. Expressing the posterior mean as a convex combination

The prior mean is:

Now, we aim to express as a convex combination of and . Consider:

Defining:

we have:

Since , it follows that .

Conclusion

We have shown that the posterior mean is a weighted average of the prior mean and the MLE , with weights and , respectively, where .

Therefore, the posterior mean lies between the prior mean and the maximum likelihood estimate:

This result illustrates how the posterior mean balances the prior belief and the observed data in Bayesian inference.


Problem 9

Consider the following probabilistic model:

where and . We have observed a single data point Task: Derive the maximum a posteriori (MAP) estimate of the parameter for the above probabilistic model. Show your work.

Solution

To calculate the maximum a posteriori, we need to compute the following formula:

From Bayes’ theorem we can derive:

Applying Equation (2) to Equation (1), we get:

From the assumptions, we know that:

  • ,
  • ,
  • .

Because of these and the concavity of the logarithm function, we know that Equation (3) is concave.

To find the maximum, we set the derivative to zero:

Solving for :

Answer: