so the first thing we need to do in this course on linear algebra is to get a handle on vectors which will turn out to be really useful for us in solving those linear algebra problems that is the ones that are linear in their coefficients such as most fitting parameters we're going to first step back and look in some detail of the sorts of things we're trying to do with data and why those vectors you first learned about in high school or even relevant and this will hopefully make all the work with vectors a lot
more intuitive let's go back to that simpler problem from the last video the histogram distribution of heights of people in the population you know there aren't many people above about two meters say and there aren't really very many people below 1.5 meters same we wanted to try fitting that distribution with an equation describing the variation of heights in the population and let's say that equation has just two parameters one describing the center of the distribution here and we'll call that mu and one describing how wide it is which we'll call Sigma so we could fit
it with some curve that had two parameters mu and Sigma and I would use an equation like this I I'd call it f of X of some function of X where X is the is the height is equal to 1 over Sigma root 2 pi times the exponential of minus X minus mu squared divided by 2 Sigma squared so this equation only has two parameters Sigma here a mu and it looks like this and it has an area here of 1 because there's only 100 percent of people in the population as a whole I don't
worry too much about the form of the equation if this one happens this is called the normal or Gaussian distribution and it's got a center at MU and a width of Sigma and it's normalized so that its area is one now how do we go about fitting this distribution that is finding mu and Sigma or the best possible music m'a that fits the data as well as is possible imagine that we had guessed that the width was wider than it really is but keeping the area at once so if we'd guess that it was a
fatter and probably a bit shorter distribution something like that say so this one has something like that this one has a wider Sigma but it's got the same mu it'd be too high at the edges here and too low in the middle so then we could add up the differences between all of our measurements and all of our estimates we've got all of these places where we underestimate here and all of these places where we overestimate here and we can add up those differences or in fact the squares of them to get a measure of
the goodness or badness of the fit and we'll look in in detail at how we do that once we've we've done all the vectors work and once we've done actually all the calculus work then we could plot how that goodness varied as we change the fitting parameters Sigma and mu and we get a plot like this so if we had our correct value our best possible value for MU here and our best possible value for the width Sigma here we get we could then plot for a given value of mu and Sigma what the difference
was so if we were at the right value we'd get a value of goodness where the the sums the squares the differences was naught and if mu was too far over if we had miss estimated Mew and we got the distribution shifted over I the width was right but we had some wrong value of MU there that we get some value of all the sums of the squares and the differences of our goodness being some value here that was higher and it might be the same if we went over the other side and we had
some value there and if we were too wide we'd get something there or too thin it would we would get something that was too thin like that something like that say so we get some other value of goodness and we could imagine plotting out all of the values of we had the same value of goodness or badness for different values of mu and Sigma and we could then do that for some other value of badness and we might get a contour that looked like this and another contour that looked like this and so on and
so forth now say we don't want to compute the value of this goodness parameter for every possible mu and Sigma we just want to do it a few times and then find our way to the best possible fit of all say we started off here with some guess that was to bigger mu and to smaller width we thought people were taller than they really are and then they were tighter packed in their Heights than they really are well what we could do is we could say well if I do a little move in mu and
Sigma then does it get better or worse and if it gets better well we keep moving in that direction so we could imagine making a vector of a change in mu and a change in Sigma and we could have our original mule and Sigma there we could have a new value you prime Sigma prime and ask if that gives us a better answer if it's better there or if music new prime Sigma prime took us over here if we will bet it's better or worse there something like that now actually if we could find what
the steepest way down the hill was then we could go down this set of contours this sort of landscape here towards the minimum point towards the point where we get the best possible fit and what we're doing here these are vectors these are little moves around space they're not moves around a physical space that moves around a parameter space but it's the same thing so if we understand vectors and we understand how to get down hills that sort of curviness of of this value of goodness that's calculus then once we've got calculus and factors we'll
be able to solve this sort of problem so we can see that the factors don't have to be just geometric objects in the physical world of space they can describe directions along any sorts of axes so we can think of vectors is just being lists if we follow the space of all possible cars for example so you know here's a car that sits back there's its window there's the fur something like that there's a car as the window we could write down in a vector all of the things about the car we could write down
its cost in Euros we could write down its emissions performance in grams of co2 per hundred kilometers we could write down its its NOx performance you know how much it polluted our city and killed people due to air pollution we could write down it's your end cap star rating how good it was in a crash we could write down its top speed and write those all down in a list that was a vector I'd be more of a computer science view of vectors whereas the spatial view is more familiar from physics in my field mythology
I could think of any always being described by a vector that describes all of the possible components all the compositions of that alloy Einstein when he conceived relativity conceived of time as just being another dimension so space-time is a four-dimensional space three dimensions of meters and one of time in seconds and he wrote those down is a vector of space-time of XYZ and time which he called space-time when we put it like that it's not so crazy to think of the space of all the fitting parameters of a function and then of vectors as being
things that takes around that space and what we're trying to do then is find the location in that space where the badness is minimize the goodness is maximized and the function fits the data best if the badness surface here was like a contour map of a landscape we're trying to find the bottom of the hill the lowest possible point in the landscape so to do this well we'll want to understand how to work with vectors and then how to do calculus on those vectors in order to find gradients in these contour maps and minima and
all those sorts of things then we'll be able to go and do optimizations enabling us to go and work with data and do machine learning and data science so in this video we've revisited the problem of fitting a function to some data in this case the distribution of heights in the population what we've seen is that the function we fit whatever it is has some parameters and we can plot how the quality of the fit the goodness of the fit varies as we vary those parameters moves around these fitting parameter space are then just vectors
in that space of fitting parameters and therefore we want to look at him we visit vector maths in order to be able to build on that and then do calculus and then do machine learning