贝叶斯定理
贝叶斯定理定义
贝叶斯定理的定义:
对于随机事件 \(A、B\) 若有 \(P(B) \neq 0\) 则存在: \[ \begin{aligned} P(A|B)*\frac{P(B)}{P(A)} &= \frac{P(AB)}{P(B)} * \frac{P(B)}{P(A)} \\ &= \frac{P(AB)}{P(A)} \\ &= P(B|A) \end{aligned} \]
稍微变一下, 可以写一个更好记的形式
\[ P(B|A) = P(A|B)*\frac{P(B)}{P(A)} \]
贝叶斯定理的推导
由条件概率公式:
\[ P(A|B) = \frac{P(A\bigcap B)}{P(B)} \tag{1} \] \[ P(B|A) = \frac{P(A\bigcap B)}{P(A)} \tag{2} \]
我们将(1)式做如下变换:
将公式1乘以 \[ \frac{P(B)}{P(A)} \\ \] 得到 \[ P(A|B) * \frac{P(B)}{P(A)} = \frac{P(A\bigcap B)}{P(A)} \tag{3} \\ \]
公式(3)的等号右边即为公式(2)的右边, 即: \[ P(A|B) * \frac{P(B)}{P(A)} = P(B|A) \tag{4} \]
公式(4) 即为贝叶斯定理公式