例子:

现有校准过的枪5把,没校准过的3把。现在某人用校准过的枪打靶中靶概率为0.8,用没校准过的枪中靶概率只为0.3。现在已知拿起一把枪打靶中靶了,请问这个枪是校准过的枪的概率?

设A事件为该枪校准过,B事件为某人打靶打中的概率。因此根据以下贝叶斯定理公式:

P(A|B)=P(B|A)*P(A)/P(B)

依次求出 P(B|A)、P(A)、P(B) 的值,则可求得 P(A|B) 。

P(A)=5/(3+5)=5/8

P(B)=3/8 * 0.3 + 5/8 * 0.8=49/80

P(B|A) =0.8

P(A|B) =40/49

Categories: Python

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *