Probability
The simplest way to understand probability is to think of them as elements in the Wayne diagram. First, you have a complete set that contains all possible outputs (such as an experiment). Now you are interested in some subsets, that is, some events. If we are studying cancer, so we observe people to see if they have cancer. In the study, if we treat all the consumers as our complete set, then there are two possible conclusions for no matter what kind of body, with or without cancer. We can divide our complete set into two events: Events "people with cancer" (expressed as a), and "people without cancer" (expressed ~ A ). We can build an image like the following:
So what is the probability of a randomly selected person having cancer? The number of elements in a is divided by U (full set ). The number of elements in a is | A | and is read as the base number of. Define the probability of A, P (A), write P (A) = | A |/| u |.
Because a can have at most the same elements as U, the probability P (A) is 1.
Is it good now? Okay. Let's add another event. If there is another screening Token test, the purpose is to determine the number of shards. The benchmark will be "positive" for some people and "negative" for some people ". If we define event B as "a positive person in the trial ". We can make another figure:
So what is the probability of a randomly selected person being "positive" in the trial? It will be the number of elements in B (the base of B, or | B |) divided by the number of elements in U. I call this p (B), and the probability of Event B is there.
P (B) = | B |/| u |.
Remember that we have handled two independent events so far. What will happen when we put them together.
We can use the same method to calculate the probability of both events (AB is short for a ∩ B ).
P (AB) = | AB |/| u |.
This is an interesting part. What can be read from it?
We are dealing with a complete set (all people), event a (person with cancer), and Event B (person with positive in the trial ).
Now there is an overlap, that is, event AB, and we can also read as "people with cancer and positive in the trial ". There were also incident B-AB or "persons not suffering from cancer and the trial was positive", and A-AB or "persons with cancer and the trial was negative ". Now, the question we want to answer is, "What is the probability of a person having cancer if a random-selected person has a positive outcome? ". In our Wayne diagram, we can translate it into "what is the probability of our AB in Area B if we are in Area B", or we can express it in another way: "If we regard region B as our complete set, what is the probability of? ". The expression is P (A | B), which reads "the probability of a given B ". So what should it be? It should be P (A | B) = | AB |/| B |.
If we divide the denominator by | u |
P (A | B) = (| AB |/| u |)/(| B |/| u |). We can rewrite the preceding equation: P (A | B) = P (AB)/P (B ).
We have effectively completed the change from U (all persons) to B (the positive persons in the trial), but we still need to deal with the probability defined in U.
Now let's ask the opposite question: "What is the probability of a positive trial (event AB) for an individual having cancer (event a) at random? ". Intuitively, P (B | A) = P (AB)/P ().
Now we can deduce the Bayesian formula and put the above two equations together. We get P (A | B) P (B) = P (B | A) P (). Whether you look at A or B, P (AB) is the same. Finally, P (A | B) = P (B | A) P () /P (B ). This is the Bayesian formula. I found that Wayne map made me understand the Bayesian formula again, and I don't need to remember it at any time. It also simplifies its application.
Demo
The following example is from yudowsky:
1% of women aged 40 years have breast cancer. Breast X-rays are positive for 80% of women with breast cancer. 9.6% of women without breast cancer also have positive breast X-rays. During a regular check, a woman in this age group has a positive breast X-Ray. What is the probability that she actually has breast cancer?
First, let's consider women with cancer.
Now women with breast X-rays positive are added. Remember that we need to cover 80% of the areas in event a and 9.6% of the areas outside event.
Obviously. Let us again limit our full set to B (women with positive breast X-rays), but there is actually only a very small probability of cancer. In this article, the answer to most doctors' questions is about 80%, which is obviously impossible! Remember that the efficacy of the Breast Test was obtained from a, "80% of women with breast cancer also have positive breast X-rays ". This can be interpreted as "what is the probability of limiting the complete set to A and B? "Or use another method P (B | ).
Even if there is no Wayne diagram, visual icons can help us apply Bayesian formulas:
1% of women in the group had breast cancer-> P (A) = 0.1
80% of those women had positive breast X-rays, and 9.6% of those women had no breast cancer.-> P (B) = 0.8 P () + 0.096 (1-p (A) = 0.008 + 0.09504 = 0.10304
We can get P (B | A) directly from the Problem description. Remember that 80% of women with breast cancer have positive breast X-rays-> P (B | A) = 0.8.
These values are now included in the Bayesian formula:
P (A | B) = 0.8*0.01/0.10304.
The answer is a probability of 0.0776 or about 7.8%, That is, assuming a positive breast X-ray is essentially a probability of breast cancer.
(The above part translated the original article: http://oscarbonilla.com/2009/05/visualizing-bayes-theorem)
Machine Learning notes-bayesian Learning