贝叶斯 定理
Bayes’ Theorem is one of the most known to the field of probability, and it is used often as a baseline model in machine learning. It is, however, too often memorized and chanted by people who don’t really know what P(B|E) = P(E|B) * P(B) / P(E)
actually does. This short article will pick apart Bayes’ Theorem and show how it simplifies to an intuitive fraction we all use on a common basis.
贝叶斯定理是概率领域中最著名的定理之一,它经常被用作机器学习中的基线模型。 然而,它经常被那些并不真正知道P(B|E) = P(E|B) * P(B) / P(E)
实际工作的人记住和高呼。 这篇简短的文章将分解贝叶斯定理,并说明如何将其简化为我们大家共同使用的直观分数。
First, some basic probability context.
首先,一些基本的概率背景。
The belief is a statement we would like to verify is correct or incorrect, like ‘a person is male’ or ‘a person has long hair’. The evidence is known information about the subject in the belief. Lastly, the |
vertical pipe is used as the word ‘given…’. You’ll often see (B|E)
as ‘the probability belief B is true, given the evidence E.’
信念是我们要验证正确或不正确的陈述,例如“一个人是男性”或“一个人有长发”。 证据是有关信念中受试者的已知信息。 最后, |
垂直管道被用作“给定...”一词。 在给定证据E的情况下,您经常会看到(B|E)
为“概率信念B为真”。
Let’s take the following table of students at Hypothetical High School.
让我们看一下假设高中学生的下表。
We want to find the probability that a person is female (belief) given long hair (evidence). This can be expressed as (female|long hair)
. Even without the theorem, this is quite simple to calculate, intuitively. We simply need to divide the number of females who have long hair by the total number of people who have long hair, which is 350/400=0.875
.
我们想要找到在长发(证据)下一个人是女性(信念)的概率。 这可以表示为(female|long hair)
。 即使没有定理,这在直观上也很容易计算。 我们只需要将长发女性的数量除以长发总数即可,即350/400=0.875
。
It’s worthwhile diving a little into why we have this intuition. Since we know that the person has long hair, we look in the column of ‘Long Hair’ and the two classes within that category (being male or female). Then, our formula is simply people who are female and who have long hair divided by all people who have long hair.
值得深入探讨为什么我们有这种直觉。 由于我们知道该人长发,因此我们在“长发”列中查找该类别中的两个类别(男性或女性)。 那么,我们的公式就是女性,长发的人除以所有长发的人。
Hence, we can confidently say that, if you have long hair, you have a 87.5% chance of being a female at Hypothetical High School.
因此,我们可以自信地说,如果您留着长发,那么在假高中成为女性的可能性为87.5%。
Let’s use Bayes’ Theorem to solve this — and you’ll realize that it is simply putting into rigorously mathematical terms this intuition!
让我们使用贝叶斯定理来解决这个问题,您会意识到,它只是将这种直觉严格地数学化了!
Variable names from a
-i
will be used to represent different quantities. Remember that our intuitive formula was e/h
, or the number of people who are female and have long hair, divided by the total number of people with long hair.
从变量名a
- i
将被用来代表不同的数量。 请记住,我们的直观公式是e/h
,即长发的女性人数除以长发总数。
Bayes formula says the following:
贝叶斯公式表示以下内容:
P(B|E) = P(E|B)*P(B) / P(E)
This translates in our scenario to:
在我们的方案中,这意味着:
P(Female|Long Hair) = P(Long Hair|Female)*P(Female)/P(Long Hair)
Let’s represent these using variables. For example, the probability that someone has long hair given that they are female is e/f
, since e
represents the number of females with long hair and f
represents the total number of females. P(Female)
is f/i
, since f
is the number of females and i
is the total number of people (males and females).
让我们使用变量来表示它们。 例如,某人由于是女性而e/f
长发的概率为e/f
,因为e
代表留长发的女性人数, f
代表女性总数。 P(Female)
是f/i
,因为f
是女性的数量,而i
是总人数(男性和女性)。
P(Female|Long Hair) = (e/f)*(f/i) / (h/i) = (e/f)*(f/i)*(i/h)
With some simple algebraic manipulation, we realize that (e/f)*(f/i)
results in (e/i)
, and (e/i)*(i/h)
equals (e/h)
— our intuitive formula!
通过一些简单的代数运算,我们意识到(e/f)*(f/i)
结果为(e/i)
,而(e/i)*(i/h)
等于(e/h)
-我们的直观公式!
So, Bayes’ Theorem is really a roundabout way to express a simple idea. At least in our context of fraction manipulation, P(B)
simply serves as a bridge to cancel out reciprocals. So, when use Bayes’ Theorem to calculate P(B|E)
, you are essentially calculating the following:
因此,贝叶斯定理实际上是表达简单思想的一种回旋方式。 至少在分数操作的上下文中, P(B)
只是充当抵消倒数的桥梁。 因此,当使用贝叶斯定理来计算P(B|E)
,实际上是在计算以下内容:
# items that are B and E / total # items that are E
Bayes’ Theorem is useful for calculating this probability if it is difficult or thorny to directly calculate this by making use of other more accessible probabilities. This can be useful when calculating three separate probabilities is less expensive than calculating one primary one.
如果难以或棘手通过利用其他更容易获得的概率直接计算此概率,则贝叶斯定理对于计算该概率很有用。 当计算三个独立的概率比计算一个主要的概率便宜时,这将很有用。
At a higher level, one may be inclined to say that Bayes’ Theorem reveals relationships in the nature of probability. At a lower — and perhaps more practical — level, Bayes’ Theorem is a clever way to get around directly calculating a probability with other probabilities and chain multiplication.
在更高的层次上,人们可能倾向于说贝叶斯定理揭示了概率性质中的关系。 贝叶斯定理在较低的水平上,也许是在更实际的水平上,是一种聪明的方法,可以直接计算其他概率和链乘法的概率。
翻译自: https://towardsdatascience.com/bayes-theorem-is-actually-an-intuitive-fraction-5f2803998006
贝叶斯 定理
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/390710.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!