Bayesian linear regression
In the previous video we have already seen the basic principle of Bayesian inference. We have factored the joint distribution as
and specified a distribution for each factor. By specifying these distributions we have encoded our assumptions and beliefs about the modelled variables. Once a measurement of the span became available, it was a simple matter of using Bayes rule to compute the posterior distribution , and thus to formally update our beliefs in light of this new data.
A crucial step in our modelling was the likelihood function. We just assumed that , i.e. that the value we observe for the length is also the mean for the span. However, we usually don't know the exact relationship and would rather like to use data to estimate how the measurements are related. This is what Bayesian linear regression allows us to do.
In this article we start by exploring the Bayesian linear regression model on the simple example of modelling the length and the span of the hand. In a second step we show how this model can be used to in the context of 3D shape model fitting using Gaussian Process Morphable Models.
Bayesian regression of 2D hands
A widely used model for learning a relationship between two or more variables is the linear regression model. In this model, the (mean-free) span is assumed to be a linear function of the length , perturbed by Gaussian noise :
Here the slope , intercept and noise variance are parameters of our model. denotes the mean length. Subtracting the mean makes it easier to interpret the intercept parameter, as we know that the intercept corresponds exactly to the span for the mean hand.
These modelling assumptions lead to the following likelihood function:
Note that the difference compared to the previous version is, that we have introduced the parameters , and . For fixed values of these parameters, we would be back at the model that we discussed in the video. But our goal here is to estimate the distribution of the parameters and , which characterize the dependency between the span and length are. Thus we need a model of the joint distribution , which we factorize as follows:1
To complete our model, we need to specify our prior beliefs about the parameters, by specifying , and .I believe, for example, that the span is approximately the same as the length irrespective of the length of the hand. I also assume that the noise parameter is positive and rather small. These beliefs can be encoded using the following prior distributions:
Note that these are just my prior beliefs. Somebody else could assign different distributions.
Bayes rule states that for a given observations we have
Under the assumptions that the observations are i.i.d. and thus the likelihood of observing the data is simply the product of the individual likelihoods, the posterior for a set of given observations becomes
This posterior distribution reflects our beliefs about the parameters after we have seen the data.
While it is difficult to compute the posterior distribution analytically, writing computer programs that compute an approximate posterior distribution is relatively simple. We will learn how to do it in the next week. Here we just show report the result of the computation. Figure 1 shows the distribution of possible parameter values of a and b after we have observed the data shown in Figure 1.
Bayesian regression for 3D shape modelling
Assume now that we have a deformation model in low-rank form, as discussed in week 5 of the FutureLearn course:
Recall that are the eigenfunction/eigenvalue pair of the covariance operator associated with the Gaussian process . If , then is distributed according to . We assumed that any target shape can be generated by applying a deformation field with the appropriate coefficients . More precisely, the correct deformation that relates a point of a given target surface with the corresponding point on the reference surface is given by
is Gaussian noise. We recognize that this is another linear regression model, as it is linear in the parameters . The corresponding likelihood function is
The prior on the shape parameters is, by assumption above,
For the noise term, we use a log-normal distribution as before
It turns out that this is exactly the setting of Gaussian process regression that we discussed in the previous course. However, with this formulation, we hope that it is now easy to see how we can generalize it to include more parameters, change the assumption about the noise or form or the likelihood function, or even relax the assumption of strict correspondence. In all the cases, a closed form solution will not be available anymore and we will have to resort to computational methods.