Bayes Theorem

最近看了3b1b发的贝叶斯定理的课程。以前对于这些概念一直很模糊,尤其是贝叶斯公式,只能把数带进去做题,不能理解这个公式的更深层次的意义,而且概率统计这门课年代久远,当初自己也是自学(当初对于这些意义重要于公式的知识自己也没有很深入地去思考),并且贝叶斯定理对于机器学习意义重大,所以再学一学,尝试理解得本质一些。

维基百科NB!!!概念性的资料不要看博客知乎百度百科!!!

我觉得自己对于这个知识点的模糊是因为不理解贝叶斯统计和频率统计的区别,概率论各个理论之间的关系后面还需认真总结

  • Level of Understanding
  • What is it saying? just can plug in numbers
  • Why is it true?
  • When is it useful?

Notion


  • Evidence

    证据:能够帮助我们更新对于假设估计的事件

  • Hypothesis

    假设:我们期望分析的对象,通常有多种互斥的假设,我们需要分析在给定证据下最可能为真的假设

  • Prior

    先验概率,根据以往经验得到的概率,可以是来自于对于历史信息的统计、背景信息

    在未考虑相关证据时得到的概率

  • Posterior

    在贝叶斯统计中,随机事件的后验概率是在考虑相关证据或数据后得到的条件概率

  • Likelihood

    语义上,likelihood 和probability意思相近

似然:表示在已知证据下概率模型中参数的似然性,用概率描述为 $P(E|\theta)$, 记为 $L(\theta;E)$

在估计概率分布的参数模型下,似然函数的值等于 ,即$L(\theta;D)=f_{\theta}(D)$

:不区分$P(A;B)$ 与 $P(A|B)$

  • 概率模型:用来描述不同随机变量之间关系的数学模型

  • 参数:概率模型中需要未确定的量

  • 极大似然估计:源于频率学派,认为概率模型的参数是一个定值,这个值可以用频率表示或解方程得到,估计最大似然的参数作为当前证据下的概率模型参数(数据(证据)决定参数取值

  • 最大后验概率估计:源于贝叶斯派,认为概率模型是不确定的,为简化认为概率模型的参数是随机变量,我们最终确定的参数值是其中参数的后验概率中最大的值,因此叫MAP(数据更新参数取值

    如把先验假设去掉,或者假设先验满足均匀分布的话,MLE和MAP一致


Formula

  • 公式
    $$P(H|E)=\frac{P(H) P(E|H)}{P(H) P(E|H) + P(\neg H) P(E|\neg H)}$$

  • 直观理解

    $P(H|E)$ 按照一般的解释为:事件E发生的情况下事件H发生(为真)的概率,在贝叶斯公式中也称为H的后验概率;

    $$posterior = \frac{likelihood \times prior}{evidence}$$

    这个公式的推导是根据条件概率公式和全概率公式得到的,直观理解是后验概率由似然和先验共同决定;

Think more

贝叶斯统计

通常我们要分析的问题是在已知证据E下,最可能发生的假设,也就是计算 最大后验概率

$$\hat H = argmax_{H_i}{P(H_i|E)}$$

以往的思维习惯是根据似然 $P(E|H)$ 和 $P(E|\neg H)$ 的相对大小来推测在证据E下,假设H(概率模型参数)为真为假的可能性(在概率模型参数估计问题下,我们容易把 $P(\theta|D)$和 $P(D|\theta)$ 搞混,也就是把似然当做后验)

$$P(H|E)_{Inertial \ thinking} = \frac{P(E|H)}{P(E|H) + P(E|\neg H)}$$

上面思考方式的缺陷是我们默认了每种假设是等可能分布的,也就是我们没有分析先验的概率分布情况;

贝叶斯定理告诉我们,分析 $P(H|E)$ 时,应当兼顾先验概率与似然,也就是在已有的思维方式上加入对于先验的思考。当我们考虑的证据与假设不相关时,新的证据并不会更新先验,也就是后验概率此时等于先验概率(无关证据不会影响我们对于结果的看法)。

$$posterior \propto likelihood \times prior$$

$$P(H|E)_{Bayes \ Theorem}=\frac{P(H) P(E|H)}{P(H) P(E|H) + P(\neg H) P(E|\neg H)}$$

The key mantra underlying Bayes’ theorem is that new evidence does not completely determine your beliefs in a vacuum; it should update prior beliefs.

证据不能决定你的看法,而是更新你的看法

Appendix

一些概率论相关的知识点

  • Probability axioms 概率公理

    又叫Kolmogorov Axioms

    The assumptions as to setting up the axioms can be summarised as follows: Let (Ω, F, P) be a measure space with P being the probability of some event E, denoted $ P(E)$}, and $P(\Omega ) = 1$ . Then (Ω, F, P) is a probability space, with sample space Ω, event space F and probability measure P.

    定义概率空间 (Ω, F, P),F为事件空间,P为概率观测,Ω为抽样空间,其本身也是一个测量空间

    First axiom

    The probability of an event is a non-negative real number:

    $$ P(E)\in \mathbb {R} ,P(E)\geq 0\qquad \forall E\in F $$

    where $F$ is the event space. It follows that $P(E)$ is always finite, in contrast with more general measure theory. Theories which assign negative probability relax the first axiom.

    非负性

    Second axiom

    See also: Unitarity (physics)

    This is the assumption of unit measure: that the probability that at least one of the elementary events in the entire sample space will occur is 1
    $$ P(\Omega )=1 $$
    全一性

    Third axiom

    This is the assumption of σ-additivity:
    Any countable sequence of disjoint sets (synonymous with mutually exclusive events) $E_{1},E_{2}\ldots$ satisfies
    Some authors consider merely finitely additive probability spaces, in which case one just needs an algebra of sets, rather than a σ-algebra. Quasiprobability distributions in general relax the third axiom.
    $$ P\left(\bigcup {i=1}^{\infty }E{i}\right)=\sum {i=1}^{\infty }P(E{i}) $$
    可列可加性

    注:摘自维基百科,对应于书本上的三个性质,但每个公理具体内容没看

  • Bayesian probability

    • 频率学派将频率视为概率,因为他们考虑的事件是独立可重复的(under frequentist inference, a hypothesis is typically tested without being assigned a probability)

    • 贝叶斯概率考虑那些非独立重复的假设( In the Bayesian view, a probability is assigned to a hypothesis),所谓假设,相比于事件,强调了未发生、不可重复

      the Bayesian probabilist specifies a prior probability. This, in turn, is then updated to a posterior probability in the light of new, relevant evidence.

Reference