Probability Theory Foundations
Transcript
For the first part of the first lecture of the semester, we're going to be covering core introductory concepts and probability theory. This is going to be absolutely essential material that you'll be coming back to and using throughout the semester. So you may need to review it many times each time you'll get a stronger understanding of it. And of course, we'll come back to it at various points in the context of other problems. And you'll have an opportunity to strengthen your understanding of it throughout this class. We'll cover foundations of probability theory, joint marginal, and conditional probability, Bayes' rule, and a simple worked example for human language we'll resort to throughout. We'll start off with probability spaces which are traditionally defined in terms of sets, and you start out with the sample space, Omega, and an event, for example, a die coming up in the number four or five coin.
Coming up, heads the next word that comes out of my mouth being the word "angel". Any of these is an event in the sample space and an event is simply a subset of the sample space. Now, a probability space on a sample space is a function from events in the sample space to numbers to real numbers. That holds the following three axioms. First of all, non-negativity. Any event in the sample space has to have a probability that greater than or equal to zero. The second is what we call disjoint union. If you have two disjoint events, that is they can't both occur at the same time, their union is – excuse me – their intersection is zero is the empty set. Then their *union's* probability – the probability of the union of E_1 and E_2 –is equal to the sum of the probabilities of the individual events. That's disjoint union. And finally, properness: the probability of the sample space itself, which is the maximum event,
It's anything at all happening, is 1. Now these are set theoretic definitions, but we can also translate them into fundamental operations in boolean logic. So, for example, the subset relationship between two sets is equivalent in boolean logic to the implicational relationship. Disjointness — that is, that the intersection between two events is the empty set, is equivalent to saying that it's not the case that both of the events hold or can hold. And union is simply equivalent to disjunction. So we'll actually move throughout the course back and forth between these set theoretic characterizations and these logical characterizations that turns out to be very convenient. And the simple example that we're going to be running throughout this part of today's lecture is very simple, but it's actually quite motivated in terms of the history of the English language. And this is also reflective of a phenomenon, word order variation, that occurs throughout the languages of the world.
Historically, there was a time in English when noun phrases – so an NP—this is your first linguistics terminology of the semester— a noun phrase, which is, for example, the subject of a sentence, often, the object of a sentence... All these are noun phrases, things like "I", or "the boy" or "every girl in the room", or "no one". These could appear as objects. And an object is something like if I say "I eat the apple" than "the apple" is the object.
An object noun phrase, or NP, could occur either preverbally or postverbally. In today's English, it's pretty much always postverbal, as in "I ate the apple". "The apple" is after the verb "ate". But in historical English there was a time when object noun phrases could occur either before the verb — that is preverbally — or after the verb, postverbally. And we're going to represent this. This is your sort of first experience, perhaps with this kind of little tree notation. We say that the verb phrase. Which is the phrase, the collection of words, a sequence of words that includes both the object and the verb, could have this form where the object comes before the verb or come with this form where the object comes after the verb, as in illustrated here. Now, if you look at the language, if you look at the languages of the world, it turns out that there is a broad cross-linguistic tendency for objects that are pronouns, like "me" or "her" or "them", to
occur earlier in sentences on average than objects that are not pronouns like "the apple" or "anyone in the room" or "the hope for justice", all of these things are object noun phrases potentially, and none of those latter ones are pronouns. There's a broad cross-linguistic tendency for objects that are pronouns to occur earlier and average on sentences than non pronominal objects. So we can imagine a set of hypothetical probabilities. We can imagine a set of hypothetical probabilities over,
over two things: One is whether the object occurs preverbally – That is before the verb, or post verbally – that is after the verb. And then the second thing is whether the object itself is a pronoun or not. And what I've done here is I've devised a sort of hypothetical. There's not real data, but it reflects real patterns in language. A hypothetical contingency table, which is the probability of each of the four possible states of affairs with respect to these distinctions.
Preverbal versus postverbal, pronoun versus not pronoun. And that contingency table, each of those entries is a probability. And the sort of the most fine grained events in this representation are the combination of whether the object is preverbal or not and whether the object is a pronoun or not. Now, these two properties, X, the preverbal or post-verbal status of the object, and Y, the pronominal or not pronominal status of the object are sometimes what we'll call random variables in the language of probability. And what I've laid out for you here is what's called the joint distribution of those two random variables. OK. And you'll notice that there's actually some interesting patterning of what those numbers are. And we'll get to that in just a moment. But terminologically, what I've introduced to you are two random variables that are grounded in a linguistically motivated property of sentences.
And this contingency table to buy two set of probabilities is the joint distribution over those two random variables. Now, we can take this example and we can check the axioms of probability. So here we'll take the sample space to be this complete selection of the set of four logically possible combinations of these two properties. So the sample space is that either the object is preverbal and a pronoun, preverbal and not a pronoun, postverbal and a pronoun, postverbal and not a pronoun – any of those four logical possibilities. And now we can check, for example. So this allows us to say we could use the disjoint union property to tell us the probability of non atomic events. So, for example, let's define another event. We'll call it E1. This is just by fiat. We can just define events as we want. And it's this property of either: The object is preverbal and a pronoun, or the object is post verbal and not a pronoun.
Disjoint union says we can compute the probability of that event because these two individual things are clearly a mutual contradictory to each other. We can compute the probability of that event as the sum of the two subba event probabilities. In this case, 0.224 is the probability of the object being preverbal and a pronoun. It's in the upper left hand corner of the contingency table. And point one of seven is the probability of the object being post verbal and not a pronoun is the lower right number and the contingency table. So the sum of those two is point three through. And according to these probabilities, Disjoint Union gives us this out. And we could apply this to any disjoint union of events. We can also check this contingency table for properness. That's simply the question of two four probability sum to one. Indeed they do.
You shouldn't be surprised. I constructed this example. It is a proper probability distribution. That's the axioms of probability. The next concept I want to introduce you to: You looked at joint probabilities and joint distributions. Sometimes we're interested in the joint distribution over multiple random variables. But actually we want to actually simplify out and go to the distribution that's applied over only one of them. Without loss of generality, If we call the two variables X and Y. Then let's just say X. The definition here is that the marginal probability distribution P of X relates to the joint probability of P of X and Y as follows: The P, the probability P of X taking on – So we'll use a lot of the time upper case letters for a random variable and lower case letters for a specific possible instantiation or specific intended instantiation of that random variable.
So lower case x here is you can say it's the particular value to noted by lowercase x, whereas capital X is the random variable and we'll often use that distinction, but sometimes we'll elide it for simplicity. The marginal probability distribution of X is that the probability that capital X takes on the value lowercase x is I take all the possible values of Y – the random variable capital Y – each of those values I'll denote with a lowercase y. So that's what this sums over the whys is. And I will sum together the joint probabilities of the particular value of X that I have in mind. So this X is correspond to that X with the summation over all of the values of the possible Y's. And that's what's called the marginal probability distribution. In our particular case, suppose I was interested from this contingency table here in finding the marginal distribution on X,
that is whether the object is preverbal or not. So, for example, the the probability that the object is preverbal is the marginal probability. That's a marginal probability. And so I'd have to sum over the possible values of Y. Either the object is a pronoun or not. I'm I'm realizing that this is a mistake here. I will correct this afterwards, later on in the slides that I put up online. But that should be pronoun and not pronoun. Likewise, this should be pronoun and not pronoun.
So the this probability here is I'm going to sum up the probability of preverbal pronoun and preverbal not pronoun, so that's 0.224 from up here and 0.655 here. And I'm gonna get 0.879. And likewise, I do the same thing at the bottom, running up 0.121, and you'll find out once again the sum of those two letter marginal probabilities are indeed is equal to one because there's a proper distribution. OK. So we have this marginal distribution on X in this marginal distribution on Y.
Now, the next concept that I want to introduce is the notion of conditional probability. Suppose that I have A give and B and an event day and I want to know what does. Knowing A due to my belief about whether B holds. That corresponds to the definition, the notion of conditional probability and definition only here what we have is that the probability of being given A is equal to. By definition, the joint probability of A and B together divided by the marginal probability of A alone.
So that's definitional. So to run another example, we go back to our contingency table, we have our joint probability table on the right, on the top. We have the two marginal probabilities below it. Suppose that I want to calculate the following property, the following quantity, which is the probability that the object will be a pronoun given that it is postverbal. At this point, actually, we're in a position to think about this from a Real-Time human language understanding perspective. This is an interesting property because it corresponds to the case where I imagine that I'm I'm a listener and I'm listening to somebody speak to me in historical English. I might wind up in a state midsentence where, remember that historical English... In our characterization of it has both preverbal and post verbal objects, and I might be in a situation where the object hasn't occurred yet. But I hit the verb. So, for example, if I hear I devoured, then I know devoured is the verb.
But I haven't heard the object yet. But I know there will be an object. And now I might be in a position to make a prediction as a listener or an inference about how likely the object is to be a pronoun or not. And it's not going to just be necessarily the marginal probability, which is what I have here, because I have additional information. I know that the object is not preverbal. It is post. And so I should actually be conditioning on the information that the object is post verbal. And that's what is encoded by that conditional probability of Y, B being pronoun, X being post verbal. And I can, from the information that I have above, run this as a conditional probability calculation by the definition of conditional probability. This conditional probability is equal to the joint of: Post verbal and pronoun divided by the marginal of post verbal. And in this case, I can get the joint up here.
And I think at the marginal down here and I divide the first by the second, and I get the result, which is point one one six, and you'll notice that that didn't occur at that point. One on six didn't occur anywhere in any of my probability so far, because it is a conditional probability that you have to use the joint in the marginal to get together. Conditional probability calculation is an essential feature of both machine learning statistics and also, it turns out, a very powerful way of thinking about how the human mind works for language. And so we're going to be resorting to conditional probabilities all the time throughout this course. And it's always a useful thing to think about when I'm posing a scientific question or a question about: what is it that an intelligent agent is doing a particular situation? What is the conditional probability that it's sort of best captures the problem that they're facing?
So the next concept I want to introduce you to is the chain rule. And this is just another sort of massaging around of the definition of conditional probability to get something that turns out empirically to be very useful. I can rewrite a joint probability, like the joint probability with at one end of that two as the product of a marginal probability of event one times the conditional probability of event to an event. What you may remember that definition, Ali, the definition of conditional probability looked a lot like this, except e one didn't appear in the numerator here. It occurred in the denominator over here. And so I get from the definition of conditional probability to this decomposition here just by multiplying both sides by P of E_1. Now, I can actually generalize this to more than two variables, and you can do this at home to check.
So this is the case of two variables. If I have three variables, I can decompose it to. For example, the probability of events one through three is probability two and three, given the first two that to get to the first one and the marginal probability of event one by itself. And I can do this for any of an indefinite number of random variables. I can do chain rule decomposition and I can also do it in any order. So there's no intrinsic ordering of the events. And that is very important and useful and we will make much use of it. It will play a prominent role in a number kinds of models that we'll be looking at throughout the class. So this generalizes to end events and so forth, breaking up joint probability down into the product of a marginal probability and several joint probabilities this way is sometimes called chain wheel decomposition.
So you'll hear me at various points in the semester, say now we apply chain rule composition. OK. The next thing and this is the last new conceptual tool that I'll be discussing in this part of the lecture is Bayes Rule, sometimes called Base Theorem. And it's a very simple idea and it's mathematically trivial. But its power comes from its application. Bayes rule, conceptually is a way of recasting a conditional probability of one variable on the other in the opposite way.
Sometimes for that reason, it's called Bayesian inversion. And in fact, originally, in the early days of the development of probability theory and Bayes rule, Bayes rule was sometimes called inverse probability. For exactly this reason, it's swapping the conditional ization. So you notice that in this example here, I have the probability of A given B. And I'm rewriting it in a form where the only conditional probability is the reverse of B given it. That's the application of Bayes Rule. In order to do this. I have to invoke the marginals in order to get equality to actually hold. This also holds, and in particular the marginals that I have to use, I have to multiply through the numerator of P, be given A by P of A. and the denominator by P of B, and actually if you run this in your head, you can find out pretty easily that this mathematically holds. It also holds with what we call sometimes extra background, random variables.
A call that I for simplicity here. And notice what's important here is that when you do that Bayesian inversion, when you swap the order of A and B with each other. So you noticed here that what was the outcome? A became the conditioning event and what was the conditioning event? B became the outcome with extra background or random variables. There are things that can stay on the conditioning side. So in this case, I the random variable, you can think of it as a collection of random variables, ie stays on the right hand side, on the conditioning side. And so here what I've done is I've applied Bayesian inversion to A and B. Ice is on the right hand side and notice that it not only appears in the right hand side here, but it also appears in the conditioning side of the marginals. Now, just to show you, if you haven't already run out of your head, how this theorem. Extremely simple theorem follows directly from the definition of conditional probability.
Remember that the chain rule decomposition, which is effectively equivalent to specifying the definition of conditional probability, says A, we can rewrite the joint of A and B as the conditional of bigger than eight times the marginal. But importantly, we could have done that in the opposite order. We could have applied chain rule, the composition in the opposite order. I could have rewritten joint of A and B is equal to A given B times B A notice that I'm stopping saying probability here that sometimes I will do that for convenience. And if you ever get confused, you can always ask me. So given that these two things hold, of course we can set the two Right-Hand sides equal to each other and then we simply divide both sides by the probability of B. And so then those two things cancel out and we have Bayes Rule, which you can see that's equivalent to the equation that's on the top.
Obviously, this doesn't hold if the probability of B is equal to zero because you can't divide by zero. But this is actually going to be a case where this conditional probability is ill defined. OK, one more close inspection of Bayes' Rule, and this is getting to the point of how it's such a powerful thing. Oftentimes the left hand side of Bayes rule the conditional probability that we want to rewrite. We will call the posterior distribution.
And to understand why we call it posterior, it's in relation to this other thing, which is what's called the prior. So suppose and now I've gotten A given B, not B given A, I've swapped the two variables around. Suppose that I'm interested in my belief about how likely Event A is to hold. That's if I have no other information. That's the marginal probability P(A) that specifies that – we call that the prior probability because it's prior to additional information being incorporated.
The additional information is that is you can see manifest in the relationship between the equation of the between the expressions for the prior and the posterior. So if I have additional information, be it changes my belief seat about a I now belief state, I'm noticing I'm using the language of probability theory to describe it, because that's what we're going to be using probability theory over and over again to do. So the idea here is that we incorporate the notion of we incorporate the additional information B and that potentially modulates our belief or our probability that able hold. And the revised value, the revised belief about A is this conditional probability of a given B. And we call that the posterior probability because it's posterior to learning information. B, what's the relationship between the posterior and the prior probabilities? That is what Bayes' Rule gives us.
And notice that if you think of the prior as sort of the starting point, the way you get from the prior to here is you change the prior in two ways. First, you multiply it by what we call the likelihood, which is the other conditional probability. The conditional probability of being given a and the likelihood basically says if A is the case, how likely would that new information be? B had been to be observed. The second thing that we have to do is divide it by the marginal of B, that is sometimes what's called the normalizing constant. And that really just makes sure that the resulting probability distribution is proper. And the fact that you only need it for that purpose turns out to be useful and important in a lot of cases. So now I'm going to return to the example of preverbal, pronominal, postverbal, non-pronominal objects,
And I'm going to use Bayes Rule to make do the same computation that we looked at before. But I'm going to take advantage of being able to give you the same information that we had before in a different form that we couldn't have used so straightforwardly without Bayes rule to compute the result. But we'll be able to use Bayes rule to compute, and it'll be a good, simple illustration of how to run Bayes Rule. So this is equivalent information not in the same form, but it's actually equivalent information. First of all, I'm giving you a prior probability, the prior probability that an object is a pronoun. And then I'm giving you two conditional probabilities. The conditional probability of the object occurring pre verbally, given that it's a pronoun and the conditional probability of it occurring post verbally, given that his pronoun.
These two conditional probabilities, of course, you can get the other two conditional probabilities, the probability of the object being post verbal, given either of these conditioning cases just by properness, subtracting from one for each of these values. OK, so now I'm going to put you in the state of mind again of the real time human language understanding. And the mechanism that I want you to think about is the underlying the computation. Of linguistic structure, linguistic prediction, linguistic meaning is always what's called incremental language processing or in the sentence level, incremental sentence processing in real time, as you're listening to every word I say. Your mind is doing extremely sophisticated computations to update your beliefs about update your cognitive state, belief about what is it that I mean, what is it that I'm likely to say next and so forth.
And by hypothesis, if that's what's going on in your mind all the time, you will be always updating. Not consciously most of the time, but you'll always be updating your implicit belief state about what I'm likely to say next. And so let's go back to that situation where midsentence I just said an opt just had a verb. I just spoke of verb, like devoured. That makes it clear that an object is coming up. But I haven't actually spoken the object yet. So if you were in your mind, using Bayesian inference to always update the probability of the object being pronominal, then I might modulate that at this point, because there's new information that I got: that the object is post-verbal. Now notice that what I've specified here is a sort of natural ordering of the random variables from the speaker's point of view. We can imagine that maybe when the speaker organizes their sentence in their minds,
maybe the first make a decision about whether to refer to something using a pronoun or not and only subsequently decide the word order. Now, it's an open question scientifically whether that's actually what we do. But it's plausible to at least entertain that possibility. It's as plausible apriori architectural setup for how some aspects of language production would work. Now, that's the speaker's point of view. But notice that these probabilities do not hand to you on a platter the conditional probability that is maybe most relevant from the comprehends point of view, from the listeners point of view that is given that an object is post verbal, how likely is it to be a pronoun? That is not directly encoded in these things. But you can compute it from these quantities. How do we do that? Well, let's see how we do it with Bayes'Rule. So here's the conditional probability in question that I'm interested in the probability that the object is a pronoun
given that it's postverbal. Bayes Rules tells me that I invert this probability into a form that has the conditionalization the other way around by saying that the probability of Y given X is equal to probability of X given Y times the prior probability of Y divided by the normalizing constant, which is the prior probability or the marginal probability of X. OK, now we've actually made some progress here because whereas before this thing didn't correspond to any of the three quantities that I had up here. Now you can see that the conditional probability that I've got here actually does correspond to something that I've got in my little table of knowledge. OK. And that's part of the beauty of Bayesian inversion, is it can transform a conditional probability query into a form that I have explicitly represented in sort of some knowledge bank.
OK. And that's actually a fundamental operation in the application of Bayes Rule in the context of A.I. research. And that's been true for decades and it's true today. However, I'm still stuck with... ...I should also say that I also get – whoops, going back one... I also had this other thing. This prior probability is also something that I know. So I'm actually in pretty good shape. But you'll notice that there's one thing I don't have yet. Which is this marginal probability. The normalizing constant. And that's actually should be no surprise to you. So in the application of Bayes Rule, computing the normalizing constant is often the very most complicated thing to do. Hey, how do we do it? We have to resort back to the fact that, first of all, the normalizing constant is a marginal probability. And we've reviewed the definition of how a marginal probability works and how to compute it.
You have to go back to the joint probability and explicitly marginalize out all the possible values of the variable that you don't care about. So I've gone to that joint probability here and I would marginalize out all the possible values of Y – that is, whether or not the object is a pronoun – but you'll notice that I actually don't still don't have that marginal probability or that joint probability here. Instead, I need to do one more step, which is I have to now rewrite the joint probability with the chain rule decomposition. I have to use the chain rule decomposition to re-express the joint of X and Y as the conditional of X given Y times the marginal of X. And notice now I've got this into a form where I have all of the individual components here. OK. And so just to express this fully, explicitly, there are two possible values of Y: either pronoun or not pronoun.
I write them explicitly out here. I do the math. And I turn my arithmetic crank, and I get an answer: 0.116. And this and you can check your work afterwards is actually if you remember, it's exactly the same number that we got early on when we were just posing – We're representing our knowledge in a different way with the joint probability table and the two marginals, and directly using the definition of conditional probability. And the point here is that actually it's arguably a more concise representation of the complete information state that we had with the joint probability and the two marginals to use this format that we have up here as a a marginal and then a couple of conditionals. It's arguably a simpler representation. And when you get bigger and more complex sets of random variables with more values, it becomes a vastly more simple representation.
And we can actually still go back and get all of the conditional probabilities that we want by applying Bayes rule in the right ways. And fortunately, we're not going to get into it today, but there's automated machinery to do a lot of that. But the conceptual work here of taking one conditional probability distribution of recasting it in terms of another is a really important lesson that we're going to see over and over again during the class. So just to to end with a little bit more information, sometimes you'll see Bayes Rule written. This is what we looked at here on the top in a different way. And they're part of this under this arises from the fact that, as you saw before, the hardest part of using Bayes rule in that case was calculating the normalizing constant. Sometimes you'll hear the normalizing constant referred to as the partition function as in this example,
it's very often that this is the hardest thing to do in Bayes' Rule. And sometimes you don't need to do it sometimes. First of all, well, sometimes you emphasize the explicit marginalization and you don't say just marginal probability of B, you say some over all the possible values of a joint of A given B. So explicitly writing the marginalization out of the variable whose prior posterior here today. The second option is to simply ignore the partition function. And to note that even without the partition function, I can express the conditional probability of A given B in terms of the prior on A and the likelihood of B given A, up to proportionality.

Ask anything
We've read this whole study set, so questions about it get the best answers.