In this video, we're going to have a deeper look at the unscented transform.
We're going to go into how it works and help to explain how it's useful for the common filter.
So the answer to transform is, in a way approximating a nonlinear transformation of a probability distribution
as a Gaussian distribution.
So assume that we have a probability distribution for a random variable vector, so we have a normal
distribution or Gaussian distribution with a main of exper and covariance of our Sigma X. This describes
a random variable vector now given a nonlinear transform that we want to apply to the distribution.
So let's say that we have a function that takes in a X variable and produces a Y variable.
We want to attain the Gaussian approximation of the resulting distribution for y the random variable
that is approximately a normal distribution with mean y bar and covariance sigma y.
So basically we want to approximate how we can transform this random variable vector through this nonlinear
function to approximate this Gaussian distribution over here.
So, for example, we can actually carry out this procedure numerically and we'll go through the steps
now, so one way is that we can generate any samples from the original distribution.
So basically we have this normal distribution for with a current main and covariance and we want to
generate the random samples of the random variable that that X and we're going to do this for I equals
one to end times.
So we're going to come up with any different variables sampled from this distribution over here.
Now, for each of these samples X I, we want to apply the non-linear transform to find the corresponding
Y I value.
So basically we take the output of these random samples, put them into this function F and then we
get a number of we get N outputs of this output function here.
Now we want to fit a Gaussian to the sample data points to obtain a Gaussian approximation of the distribution
of our sample points.
So basically all this is is the calculating machine.
So this is the expectation operator to get Y bar and then we calculate the covariance, basically a
difference of the samples from the main and we calculate the covariance, we get our sigma y and then
these two parameters is a main and the covariance basically gives us the parameters for this normal
distribution that basically approximates this distribution of our Y sample points.
So that's how we would carry out the procedure numerically.
So now let's have a look at a more concrete example.
Let's have a look at a numerical example of a non-linear probability transformation or a common problem
of transforming a range and bearing in system or measurement into a Cartesian coordinate frame.
So let's generate a thousand samples from the Gaussian distribution as shown here with main expert and
covariance Sigma X, where in this case the main vector consists of a range and bearing and it's going
to have a main value of 100 meters for the range and for PI over four, four or forty five degrees for
the bearing.
The covariance matrix can also be set up to be a diagonal matrix, with the uncertainty for the range
being five meters squared for the range variance or PI over seven radians squared for the bearing uncertainty.
So if we put a sample of the thousand points that we generate, we might look something like this.
So we have an ellipse for the unscented distribution for our random variable X that has a normal distribution
or main export and covariance Sigma X, so the center point on the range axis is going to be at 100
meters and the center point for the bearing is going to be at 45, which is what we've set up over here.
And you can see that we've generated a thousand points and they all lie within this ellipse for the
uncertainty.
Now we're going to transform those 1000 points using a transformation function and basically this function
is going to be this equation here.
So we take the range and bearing measurement or one system.
We put it into these two trigonometry equations to calculate the Cartesian coordinates of X and Y.
Once we do that, we want to then fit a Gaussian to the Cartesian coordinate frame, so we apply the
main equation here and we apply the covariance equation here to fit basically a normal distribution
or a Gaussian, the lips to the data.
So if we do that, we'll end up with the several points that look like this.
So here we have the transform sample points.
So all these red crosses correspond to one of the blue crosses in the previous diagram.
And you can see from this diagram here, you can say they're a very nonlinear shape for the range and
bearing.
And this is what we expected to actually happen.
Since we have such a large bearing on certainty, it means that we've got quite a large nonlinear component
due to these nonlinear terms of the sign and cause.
But we can see that once we fit and ellipse to this, so we end up with a normal distribution, with
a main Y bar and Sigma X Y for the covariance.
Based on these equations here, we can see that this is an a linear approximation of these nonlinear
data points.
And you can see in this case we have a main Cartesian coordinate frame or about 63 and 64 meters for
the X and Y components.
So this is basically the idea behind the onset and transform.
But instead of taking a thousand random sample points and then for the galaxy into this, we want to
do this a bit more intelligently.
So this is where the unscented transform comes in.
We can approximate the new distribution by randomly sampling, as we've just done.
However, can we do this in a more intelligent way by selecting a minimum set of key points, a sample
which provide us as much information as possible?
So the unseen and transform is about selecting these key single points to capture the distribution shape
with a minimum number of points used.
So this is where it becomes more computationally efficient.
So rather than taking a thousand points or even more, we can generate just a few minimum points of
similar points and propagate them through the nonlinear model to actually come up with a better estimate
of the final resulting Gaussian distribution.
The signal points are going to be based on the square root of the variance, so this is why they get
given called Sigma, because it's based on the square root of the covariance, which is the standard
deviation, which is normally called sigma.
So the unscented transform is as follows.
We want to let explained by one random variable vector with main exper and covariance P so n here is
the number of states or the dimension of the state vector X.
So if we graph this, this is basically saying we have a normal distribution of X bar and covariance
peso.
X Bar is the center point here and P defines the uncertainty elipse given by over here.
We want to choose to end SGML points where Excite denotes the sigma point and we're going to choose
these single points using the following equation.
We basically want each sigma point to be the main vector plus a delta amount based on the number of
Sigma Point.
It is where I goes from one all the way up to obviously to N.
So for the first and single points, the Delta amount, for the single point, I is just going to be
the eighth column of the square root of the covariance matrix multiplied by the number of days end.
So this means that the Doderer Vector amount for each single point is just the column of the square
root of the covariance matrix.
So you're looking at this example over here.
The square root of this uncertainty ellipse here is going to be basically from the main plus this direction
over here to give us this sigma point.
And for the second single point, because we have it two dimensions.
So it's two states is going to be the main plus this amount over here.
So these are going to give us two positive signal points now for the remaining segments.
So for eye is equal to and plus one all the way up to to end.
So basically each of the Delta amounts is just going to be a negative of this column of the square root
of the covariance matrix.
So that will give us these two sigma points down here.
So as you can see, the Sigma points pretty much define the plus and minus of the different axes majors
of the Ellipse.
So this turns out to be a good approximation of the shape of the uncertainty covariance.
So that way you can use these points to transform it, to get the new uncertainty ellipse from the transform
equations.
So now let's look at how to approximate the main from the sigma points.
So basically, for each of the signal points, we want to put them into the nonlinear transformation
that we want to apply.
So basically, this is the original Sigma Point.
We put it into the nonlinear transformation and we get the Transform Sigma Point up here and we do this
for I equals one all the way up to to end.
So on this diagram here, that will be the same as taking each point.
So let's take this point over here.
We put it into the anomaly and transform and it transforms it up to this point over here.
And we do that for all the other points or the signal points to calculate all the transform sigma points.
So once we've transformed all the sigma points, we can start to estimate the mean of the new probability
distribution.
And to do this, we can look at the weighted mane of the transform data points.
So we're going to have this weighting matrix here, which is going to be one over to N, and we're going
to multiply that by each of the Sigma points and we're going to sum it all up.
So basically you end up with this equation here.
So this equation here is going to calculate the mean all the way to Maine of all the sigma points.
So on this diagram over here, that would produce the main point that looks something like here, the
final step in the transformation process is now to recover the covariance or approximate the covariance
from these weighted samples.
And to do this, we're going to use these equations here.
So all this is basically just a weighted covariance.
We use the same weighting matrix from what we used in the main, and we calculate the covariance and
we end up with this equation here.
So if we evaluate this equation here, it would give us the uncertainty ellipse for this transform distribution.
And it looks something like this.
So the mean and covariance give us a approximation of the normal distribution which would fit to these
data points.
So basically we have the main and the covariance and we assume it's a normal distribution.
So this is how we can take an original probability distribution, generate the single points, transform
them through the nonlinear, transform and then recover an approximation of the Gaussian distribution
that describes the nonlinear transformation.
So the procedure we showed before is for the uncited transform in the space form.
How are these different versions of the unscented and transform?
And we're going to show a more generalized version of the onset and transform.
And this is a version that's usually used inside typical filters.
So the general answer, transform makes a few modifications to the algorithm that we've shown on the
previous slides.
So the basic answer to transform is third order, accurate for the approximation of the main and covariance
of the transformation, it is possible to reduce the higher order errors for the approximation by using
different weightings in the calculations, depending on the type of distribution of the underlying error,
i.e., if the error distribution is Gaussian, then it's possible to reduce the fourth or the error
terms by using an appropriate weighting function.
The general unscented transform allows for different weighting functions to be unemployed.
So this is what actually is typically used inside common filtering that uses the answer to transform.
So the general answer, the transformation is as follows, so we want to generate two and plus one single
points, so instead of just using two and similar points, we're going to add an extra sigma point.
So we're going to use two and plus one single point.
And basically all what we are going to do is that instead of starting asking the points from one, we're
going to start them from zero and at zero, the Delta amount is just going to be zero.
So the Zero Sigma Point is just the main of the distribution and the rest of the calculation is follows.
Pretty similar, except instead of multiplying the covariance matrix before we take the square root
by PN, we're going to multiply it by and plus Kapa.
So this cappa here is a scaling concept that we're going to change to get different effects based on
the underlying distribution.
So with this new definition, we have to change the way we calculate the weights for the weddings inside
the main and the covariance calculations, so the wait for as Earth single point is just going to be
this cappa divided by N plus Kapa.
And for the rest of the sigma points, we're just going to have the waiting to be one over two times
and plus Kapa.
Once we've updated the Sigma Point and the weighting, the rest of the calculation follows exactly the
same.
We basically calculate the mean using our weighted, using our weighted average and we calculate the
covariance using our weighted covariance.
Now, for when we use a Gaussian distribution, the following weights have been shown to improve the
accuracy of the calculation, to reduce the fourth error terms down to zero.
And this is when we set Kapa Eagles' to three minus N, and of course, this only works when N plus
cappa does not equal to zero.
So this is how the general unscented transformation works and this is what they're going to be using
inside or out filtering examples.