Bayesian Reasoning

Bayesian reasoning works on the mathematical foundations of probabilities.  What this means is that you (or at least the computer) needs to know all the probabilities in order to find the answers for you.  The probability that you will get a disease can be shown as follows: P(d)   or if we know more information, such as some symptoms of the disease, we can say the probability of getting a disease given a symptom: P(d|s).  This probability can be equated to (probability of the disease given the symptom) = (the number of people who have both the disease and the symptom) / (total number of people having the symptom).  In mathematical terms:

 

P(d|s) = |dÇs|/|s|   è  P(d|s) = P(dÇs)/P(s).

 

Using some simple mathemagic we can determine a few things:

 

P(s|d) = P(dÇs)/P(d)

P(dÇs) = P(s|d) * P(d)

 

Substituting back into our first equation:

 

P(d|s) = (P(s|d) * P(d))/P(s)

 

Something to keep in mind when working with this architecture is that it is easier to determine the number of patients who have a symptom when they have a certain disease than it is to determine the number of patients who have a disease when they have a certain symptom.  This is important because we want the easier to find numbers to go on the right side of our equation in an attempt to improve speed and efficiency.  Another thing to keep in mind is that the probability of a disease given a symptom is not the same as the probability of a symptom given a disease.  Also for everything we have mentioned so far, there has only been one disease and one symptom.  Bayesian Belief Networks will cover multiple diseases and multiple symptoms.

            Next we will need to determine how to calculate the probability of a hypothesis we might have.  This equation is given to us as the (probability of our hypothesis given some evidence) = ( (probability of observing the evidence given the hypothesis is true) * (the overall probability of our hypothesis being true) ) / ( (Sum of all the relationships between evidence and hypotheses) * (probability of all hypotheses) ).  Lets see this in action:  Suppose we are now making a Bayesian Reasoning system for our knight from the previous examples.  Our two possible hypotheses can be that the dragon is in his cave (guarding the treasure/sleeping/doing whatever), or the dragon is not in his cave (flying around looking for food, looking for more treasure, terrorizing the local population).  Our scouts have done a little research on the dragon and have given you information about what to look for to help determine if the dragon is in the cave or not.  Smelling smoke could mean either of our hypothesis because something could have been left on fire but the dragon left his cave.  It could also mean that the dragon is in his cave.  We don’t rule out this information because it still holds some significance as to if the dragon is in his cave or not.  If we hear animals screaming from within the cave, we can rule out the possibility of the dragon being out of the cave because no animal is stupid enough to go wandering into a dragon’s den.  Likewise, if we can see treasure, then we know the dragon is out of his cave because the dragon will always lie on his gold to protect it.  As we are going into the cave, we smell smoke (our evidence) and we want the dragon to be in his cave, so we are going to hypothesize that he is in the cave.  Looking at the information that our scouts gave us:

 

Dragon is in cave (d)

Smell smoke (s)

Probability

True

True

0.4

True

False

0.1

False

True

0.3

False

False

0.2

 

We can say that there is a .5 chance that the dragon is in his cave (with or without smoke), and a .7 chance that we will smell smoke.  Now we can calculate the probability of the dragon being in the cave given that we smell smoke or P(d|s).

 

P(d|s) = P(d=true, s=true) / ( P(d=true, s=true) + P(d=false, s=true) )

   .57  = 0.4 / (0.4 + 0.3)

 

So before we smelt the smoke, there was a 0.5 chance that the dragon was in the cave.  Now with the new evidence of smelling the smoke, there is a 0.57 chance that the dragon is in the cave.  These probabilities can be used to help us make decision.  Instead of not knowing if the dragon is going to be in front of us or behind us as we enter the cave, we can have more confidence that the dragon is in the cave and that will help prepare us for the upcoming battle.

 

|<    <    >    >|