{
  "id": "bernoulli-distribution",
  "title": "伯努利分布",
  "lang": "zh-Hans",
  "source_lang": "en",
  "summary": "描述单次二元结果的离散概率分布，取值为 1 的概率为 p，取值为 0 的概率为 1−p。",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "两点分布",
    "0-1 分布"
  ],
  "generated_at": "2026-10-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/zh/bernoulli-distribution/",
  "translations": {
    "en": {
      "url": "https://aiwiki.page/en/bernoulli-distribution/",
      "json": "https://aiwiki.page/en/bernoulli-distribution.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "伯努利分布是一种离散概率分布，用于描述只取 0 和 1 两个值的随机变量。它只有一个参数 \\(p\\)，表示观测到 1 的概率；观测到 0 的概率则为 \\(1-p\\)。它描述单次二元观测，例如硬币是否正面朝上，或某个零件是否通过检验。通常用“成功”和“失败”分别表示 1 和 0，但这并不意味着其中某个结果更值得期待。(online.stat.psu.edu)"
    },
    {
      "heading": "定义与表示",
      "text": "记 \\(X\\sim\\operatorname{Bernoulli}(p)\\)，其中 \\(0\\leq p\\leq1\\)，其概率质量函数为\n\n\\[\\Pr(X=x)= \\begin{cases} 1-p,&x=0,\\\\ p,&x=1,\\\\ 0,&\\text{其他情况}. \\end{cases}\\]\n\n当 \\(0<p<1\\) 时，可以简写为\n\n\\[\\Pr(X=x)=p^x(1-p)^{1-x}, \\qquad x\\in\\{0,1\\}.\\]\n\n当 \\(p=0\\) 时，该变量必然等于 0；当 \\(p=1\\) 时，它必然等于 1。这两种情形都是同一分布族的退化情形。(online.stat.psu.edu)\n\n伯努利变量也可以表示事件 \\(A\\) 是否发生。事件 \\(A\\) 的指示随机变量 \\(\\mathbf{1}_A\\) 在 \\(A\\) 发生时等于 1，否则等于 0，因此其参数为 \\(p=\\Pr(A)\\)。所考察的试验不必只有两个基本结果：掷一枚骰子并记录点数是否为六，得到的就是一个伯努利变量，尽管骰子本身有六种可能的结果。(probabilitycourse.com)"
    },
    {
      "heading": "均值、方差与不确定性",
      "text": "其期望值和方差为\n\n\\[\\mathbb E[X]=p, \\qquad \\operatorname{Var}(X)=p(1-p).\\]\n\n由于 \\(X^2=X\\)，二阶矩也等于 \\(p\\)，由此可直接得到方差为 \\(p-p^2\\)。因此，标准差为 \\(\\sqrt{p(1-p)}\\)。方差在 \\(p=1/2\\) 时达到最大值 \\(1/4\\)，在两个端点处均为零。与许多分布族不同，伯努利分布的均值与方差不能独立选定。这些性质都可以直接从其概率质量函数推导出来。(online.stat.psu.edu)\n\n在信息论中，其以比特为单位的信息熵为\n\n\\[H(X)=-p\\log_2p-(1-p)\\log_2(1-p),\\]\n\n其中，根据连续性，将 \\(0\\log_2 0\\) 定义为 0。当结果确定时，熵为零；当两个结果等概率时，熵达到一个比特。它衡量的是观测结果的不确定性，而不是对所估计参数的不确定性。(web.stanford.edu)"
    },
    {
      "heading": "重复观测与二项分布",
      "text": "若 \\(X_1,\\ldots,X_n\\) 是相互独立且具有相同参数 \\(p\\) 的伯努利变量，则它们的和\n\n\\[S=\\sum_{i=1}^{n}X_i\\]\n\n服从参数为 \\(n\\) 和 \\(p\\) 的二项分布。因此，伯努利分布是二项分布在试验次数为一次时的特例。两者的区别在于：前者记录单次试验的结果，后者统计多次试验中的成功次数。(online.stat.psu.edu)\n\n这一结论既要求统计独立性，也要求各次试验的成功概率相同。各个二元观测可以分别服从伯努利分布，但它们的和未必服从上述二项分布：观测之间可能相互依赖，或者成功概率可能不同。仅知道各观测的边缘分布是伯努利分布，并不能确定观测之间的关系。(online.stat.psu.edu)\n\n对于具有共同参数 \\(p\\) 的独立观测，样本比例 \\(\\bar X=S/n\\) 的均值为 \\(p\\)，方差为 \\(p(1-p)/n\\)。中心极限定理说明了为何在 \\(0<p<1\\) 的条件下，随着样本量增加，其抽样分布会趋近于正态分布。这里讨论的是汇总统计量，而不是单个二元观测的分布。(online.stat.psu.edu)"
    },
    {
      "heading": "参数估计",
      "text": "在统计学中，假设 \\(n\\) 次独立观测中有 \\(s\\) 次成功。对于所观测到的序列，似然函数为\n\n\\[L(p)=p^s(1-p)^{n-s}.\\]\n\n其对数为\n\n\\[\\ell(p)=s\\log p+(n-s)\\log(1-p).\\]\n\n通过最大似然估计可得\n\n\\[\\hat p=\\frac{s}{n},\\]\n\n即观测到的成功比例。当两种结果都出现时，对对数似然函数求导并求其最大值，即可得到这一结果。如果所有观测值均为 0 或均为 1，则最大值位于相应的端点。(stat135.berkeley.edu)\n\n在贝叶斯推断中，贝塔分布是 \\(p\\) 的共轭先验。若先验分布为 \\(\\operatorname{Beta}(\\alpha,\\beta)\\)，则观测到 \\(s\\) 次成功和 \\(n-s\\) 次失败后，得到的后验分布为\n\n\\[p\\mid\\text{数据}\\sim \\operatorname{Beta}(\\alpha+s,\\beta+n-s).\\]\n\n这里，伯努利分布描述给定 \\(p\\) 时观测值的条件分布，而贝塔分布描述对 \\(p\\) 本身的不确定性。(bayesball.github.io)"
    },
    {
      "heading": "二元预测模型",
      "text": "在机器学习中，逻辑回归对给定解释变量时的二元响应建立条件模型：\n\n\\[Y\\mid\\mathbf{x}\\sim\\operatorname{Bernoulli}(p(\\mathbf{x})), \\qquad p(\\mathbf{x})= \\frac{1}{1+\\exp(-\\mathbf{x}^{T}\\boldsymbol{\\beta})}.\\]\n\n因此，不同观测的概率可以不同，但每个响应的条件分布仍然是伯努利分布。这是一种二元响应的广义线性模型。(web.stanford.edu)\n\n对于观测标签 \\(y\\) 和预测概率 \\(\\hat p\\)，负对数似然为\n\n\\[-\\bigl[y\\log\\hat p+(1-y)\\log(1-\\hat p)\\bigr].\\]\n\n这就是二元交叉熵，可用作损失函数。它评估的是概率预测，而不只是根据阈值判定的分类是否正确：如果给实际发生的结果赋予极低的概率，就会产生很大的损失。(cs229.stanford.edu)"
    }
  ],
  "links": [
    "probability-distribution",
    "random-variable",
    "probability",
    "probability-mass-function",
    "indicator-function",
    "expected-value",
    "variance",
    "standard-deviation",
    "information-theory",
    "bit",
    "information-entropy",
    "binomial-distribution",
    "statistical-independence",
    "central-limit-theorem",
    "normal-distribution",
    "statistics",
    "likelihood-function",
    "maximum-likelihood-estimation",
    "bayesian-inference",
    "beta-distribution",
    "conjugate-prior",
    "prior-distribution",
    "posterior-distribution",
    "machine-learning",
    "logistic-regression",
    "generalized-linear-model",
    "cross-entropy",
    "loss-function"
  ],
  "sources": [
    {
      "title": "online.stat.psu.edu/stat504/Lesson01",
      "url": "https://online.stat.psu.edu/stat504/Lesson01"
    },
    {
      "title": "probabilitycourse.com/chapter3/3_1_5_special_discrete_distr.php",
      "url": "https://www.probabilitycourse.com/chapter3/3_1_5_special_discrete_distr.php"
    },
    {
      "title": "web.stanford.edu/~montanar/RESEARCH/BOOK/partA.pdf",
      "url": "https://web.stanford.edu/~montanar/RESEARCH/BOOK/partA.pdf"
    },
    {
      "title": "online.stat.psu.edu/stat500/Lesson04",
      "url": "https://online.stat.psu.edu/stat500/Lesson04"
    },
    {
      "title": "stat135.berkeley.edu/spring-2026/lectures/lecture-10.html",
      "url": "https://stat135.berkeley.edu/spring-2026/lectures/lecture-10.html"
    },
    {
      "title": "bayesball.github.io/BOOK/proportion",
      "url": "https://bayesball.github.io/BOOK/proportion"
    },
    {
      "title": "web.stanford.edu/class/stats305b/notes/Logistic_I.html",
      "url": "https://web.stanford.edu/class/stats305b/notes/Logistic_I.html"
    },
    {
      "title": "cs229.stanford.edu/lectures-spring2022/main_notes.pdf",
      "url": "https://cs229.stanford.edu/lectures-spring2022/main_notes.pdf"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}