All right. So let's put some of these rules into play
by actually doing some inference by hand. Ultimately, we're going to derive
some algorithms that can do this so you don't have to
think about it so hard. But understanding those algorithms, it's helpful to
have gone through an exercise where you actually use these ideas.
So here's a setup. Let's imagine that we've got two boxes. Onee
has 4 balls in it and one has 5 balls in it.
And we're going to choose one of those boxes uniformly at random.
Either the box that we choose is equal to box 1,
or the box that we choose is equal to box 2.
And after that, we're going to draw at random, uniformly at
random, from what's inside the box, one of the balls, and
let's say it turns out to be green. All right. So
the draw that we make, we have a green ball. We
reach into that same box a second time, and the question
is, what's the probability that that second ball will be blue,
given that the first one we drew was green? So
let's, to make, maybe to help point out how this
is connected with Bayes net inference, Charles, why don't you
help me draw the Bayes net that corresponds to this problem.
>> Okay. So, if I think about it as
a process, which now means I'm, I'm thinking about this
as things causing the other, the first thing that
you did in the process is you picked the box.
>> Good. All right. So let's say, so the first variable in
the net is going to be the box variable.,
>> Right, and then once I had the box variable
over there, I can then pick, the second thing in
the process is I pick a ball. So, in this
case you're calling it 1. So I make the first pick.
>> And is it, do we need an arrow there?
>> Yeah, because the, you pick the box and
then that let's you pick which ball that you have.
So, which ball you pick, the color of the
ball you pick, depends upon the box so to speak.
>> Good. And so, the probabilities here are
going to be, it's going to look like this.
All right. So the second variable here is what, what
color ball you get when you do the first draw
from the box. Ad we can represent this as a
conditional probability table. So for box 1, it's three quarters
green, one quarter yellow or orange, zero for blue. And
for box 2, it's two fifths, zero, and three fifths.
And so that captures what happens on the first draw.
>> So for the second draw,
well, clearly, that sort of depends upon what you drew
the first time. Because you said we were drawing without
replacement. So it definitely depends upon what you, what you
drew the first time. But also, it still depends upon
the box. Okay, so now we've got tables for a
box, we've got tables for ball 1, and we need
to know what ball 2 is going to be. Well,
the value that ball 2 takes definitely depends upon whatever
value ball 1 takes.
>> Sure.
>> But it also depends upon which box you're
in. So you need an arrow from there as well.
And what would be really nice is if we
were in the storm, lightening and thunder case where, if
I knew that it was, what ball 1 was,
I would know what ball 2 was, but that's not
true. Because in a case, for example, when ball
1 is green, it doesn't tell me what ball 2
is unless I also know which box I'm in. So,
we have to draw the arrow from box to ball 2.
>> Indeed. Right. And so there's a lot
of, a lot of probabilities that we have
to write down. But let's, let's just write down a piece of that table. Let's say
that the value of ball 2 depends on which box. And it depends on what
ball 1 is. But let's just look at the piece of that table where ball 1 is green.
>> hm.
>> because that's what we're
ultimately going to need here. So now ball 2, in
the case where we were drawing from box 1, that
probably that's green. In the case were the first ball
had been green, it leaves just 2 out of 3, right.
>> hmm.
>> And 1 out of 3 yellow and no blue. But on the other hand, had we drawn
from box 2 first, and again, we had gotten green, now it's green one fourth,
zero yellow, and blue three quarters.
>> RIght.
>> And there's yeah, we need this same
thing where the other case, where ball 1 is
yellow and ball 1 is blue. But we are
not going to need those numbers for this problem.
>> Right.
>> All right. So now that we have written it as
a Bayes net, is that, is that helpful at all? So what
we're, we haven't asked the question yet. So maybe it's time
to ask the question and then we could work on the answer.
>> Okay.
>> All right. The question
is, what's the probability that the second draw is
blue, given that the first draw had been green? Go.