math-skill 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en-US.md +159 -200
- package/README.md +159 -200
- package/agents/math-critic.en.md +2 -2
- package/agents/math-critic.md +8 -8
- package/commands/ask.md +3 -10
- package/design-patterns/attention/equivariant-attention.en.md +72 -0
- package/design-patterns/attention/equivariant-attention.md +72 -0
- package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
- package/design-patterns/attention/geometry-aware-attention.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
- package/design-patterns/attention/information-bottleneck-attention.md +72 -0
- package/design-patterns/attention/projection-attention.en.md +68 -0
- package/design-patterns/attention/projection-attention.md +68 -0
- package/design-patterns/attention/spectral-attention.en.md +71 -0
- package/design-patterns/attention/spectral-attention.md +71 -0
- package/design-patterns/compression/leverage-score-selection.en.md +71 -0
- package/design-patterns/compression/leverage-score-selection.md +71 -0
- package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
- package/design-patterns/compression/low-rank-kv-cache.md +60 -0
- package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
- package/design-patterns/compression/spectral-token-pruning.md +61 -0
- package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
- package/design-patterns/compression/topology-preserving-compression.md +64 -0
- package/design-patterns/loss/constraint-penalty.en.md +67 -0
- package/design-patterns/loss/constraint-penalty.md +78 -0
- package/design-patterns/loss/contrastive-loss.en.md +59 -0
- package/design-patterns/loss/contrastive-loss.md +68 -0
- package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
- package/design-patterns/loss/information-bottleneck-loss.md +74 -0
- package/design-patterns/loss/orthogonality-loss.en.md +56 -0
- package/design-patterns/loss/orthogonality-loss.md +60 -0
- package/design-patterns/loss/variational-loss.en.md +61 -0
- package/design-patterns/loss/variational-loss.md +71 -0
- package/design-patterns/representation/equivariant-split.en.md +87 -0
- package/design-patterns/representation/equivariant-split.md +89 -0
- package/design-patterns/representation/manifold-representation.en.md +85 -0
- package/design-patterns/representation/manifold-representation.md +87 -0
- package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
- package/design-patterns/representation/shared-private-decomposition.md +86 -0
- package/design-patterns/representation/subspace-alignment.en.md +90 -0
- package/design-patterns/representation/subspace-alignment.md +92 -0
- package/design-patterns/routing/graph-routing.en.md +79 -0
- package/design-patterns/routing/graph-routing.md +81 -0
- package/design-patterns/routing/moe-routing.en.md +85 -0
- package/design-patterns/routing/moe-routing.md +87 -0
- package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
- package/design-patterns/routing/optimal-transport-routing.md +72 -0
- package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
- package/design-patterns/routing/spectral-clustering-routing.md +90 -0
- package/knowledge-base/differential-geometry/connection.en.md +51 -0
- package/knowledge-base/differential-geometry/connection.md +51 -0
- package/knowledge-base/differential-geometry/curvature.en.md +49 -0
- package/knowledge-base/differential-geometry/curvature.md +49 -0
- package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
- package/knowledge-base/differential-geometry/geodesic.md +51 -0
- package/knowledge-base/differential-geometry/manifold.en.md +47 -0
- package/knowledge-base/differential-geometry/manifold.md +47 -0
- package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
- package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
- package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
- package/knowledge-base/differential-geometry/tangent-space.md +48 -0
- package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
- package/knowledge-base/information-geometry/fisher-metric.md +56 -0
- package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
- package/knowledge-base/information-geometry/natural-gradient.md +54 -0
- package/knowledge-base/lie-theory/equivariance.en.md +54 -0
- package/knowledge-base/lie-theory/equivariance.md +54 -0
- package/knowledge-base/lie-theory/group-action.en.md +51 -0
- package/knowledge-base/lie-theory/group-action.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
- package/knowledge-base/lie-theory/lie-algebra.md +51 -0
- package/knowledge-base/lie-theory/lie-group.en.md +51 -0
- package/knowledge-base/lie-theory/lie-group.md +51 -0
- package/knowledge-base/lie-theory/representation.en.md +52 -0
- package/knowledge-base/lie-theory/representation.md +52 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
- package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
- package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
- package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
- package/knowledge-base/matrix-analysis/projection.en.md +47 -0
- package/knowledge-base/matrix-analysis/projection.md +47 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
- package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
- package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
- package/knowledge-base/optimization/constrained-optimization.md +53 -0
- package/knowledge-base/optimization/convex-optimization.en.md +50 -0
- package/knowledge-base/optimization/convex-optimization.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
- package/knowledge-base/optimization/lagrangian-duality.md +50 -0
- package/knowledge-base/optimization/proximal-method.en.md +52 -0
- package/knowledge-base/optimization/proximal-method.md +52 -0
- package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
- package/knowledge-base/optimization/riemannian-optimization.md +51 -0
- package/knowledge-base/overview.en.md +29 -218
- package/knowledge-base/overview.md +29 -220
- package/knowledge-base/probability/concentration-inequality.en.md +45 -0
- package/knowledge-base/probability/concentration-inequality.md +45 -0
- package/knowledge-base/probability/entropy.en.md +47 -0
- package/knowledge-base/probability/entropy.md +47 -0
- package/knowledge-base/probability/fisher-information.en.md +48 -0
- package/knowledge-base/probability/fisher-information.md +48 -0
- package/knowledge-base/probability/information-bottleneck.en.md +49 -0
- package/knowledge-base/probability/information-bottleneck.md +49 -0
- package/knowledge-base/probability/kl-divergence.en.md +51 -0
- package/knowledge-base/probability/kl-divergence.md +51 -0
- package/knowledge-base/topology/euler-characteristic.en.md +54 -0
- package/knowledge-base/topology/euler-characteristic.md +54 -0
- package/knowledge-base/topology/fundamental-group.en.md +52 -0
- package/knowledge-base/topology/fundamental-group.md +52 -0
- package/knowledge-base/topology/persistent-homology.en.md +54 -0
- package/knowledge-base/topology/persistent-homology.md +54 -0
- package/lenses/algorithmic.en.md +49 -0
- package/lenses/algorithmic.md +49 -0
- package/lenses/axiomatization.en.md +48 -0
- package/lenses/axiomatization.md +48 -0
- package/lenses/categorical.en.md +48 -0
- package/lenses/categorical.md +48 -0
- package/lenses/causal.en.md +49 -0
- package/lenses/causal.md +49 -0
- package/lenses/duality.en.md +47 -0
- package/lenses/duality.md +47 -0
- package/lenses/game.en.md +50 -0
- package/lenses/game.md +50 -0
- package/lenses/geometric.en.md +53 -0
- package/lenses/geometric.md +53 -0
- package/lenses/local-to-global.en.md +52 -0
- package/lenses/local-to-global.md +52 -0
- package/lenses/perturbation.en.md +51 -0
- package/lenses/perturbation.md +51 -0
- package/lenses/probabilistic.en.md +48 -0
- package/lenses/probabilistic.md +48 -0
- package/lenses/projection.en.md +50 -0
- package/lenses/projection.md +50 -0
- package/lenses/spectral.en.md +52 -0
- package/lenses/spectral.md +52 -0
- package/lenses/symmetry.en.md +49 -0
- package/lenses/symmetry.md +49 -0
- package/lenses/topological.en.md +48 -0
- package/lenses/topological.md +48 -0
- package/lenses/variational.en.md +48 -0
- package/lenses/variational.md +48 -0
- package/package.json +9 -3
- package/references/books/abstract-algebra.md +5 -5
- package/references/books/algebraic-geometry-rising-sea.md +5 -5
- package/references/books/differential-geometry.md +3 -3
- package/references/books/matrix-analysis.md +4 -4
- package/references/books/micro-lie-theory.md +3 -3
- package/references/books/optimization-ml.md +1 -1
- package/references/books/smooth-manifolds.md +3 -3
- package/references/gpu-friendly-math.en.md +8 -8
- package/references/gpu-friendly-math.md +2 -2
- package/references/inspiration.en.md +1 -1
- package/references/inspiration.md +2 -2
- package/skills/math-research-activator/SKILL.en.md +161 -106
- package/skills/math-research-activator/SKILL.md +162 -110
- package/skills/math-research-activator/original-texts.en.md +9 -9
- package/skills/math-research-activator/original-texts.md +11 -11
- package/commands/abstraction.md +0 -11
- package/commands/algorithmic-thinking.md +0 -11
- package/commands/axiomatization.md +0 -11
- package/commands/causal-inference.md +0 -11
- package/commands/discrete-combinatorial.md +0 -11
- package/commands/game-theory.md +0 -11
- package/commands/induction-analogy.md +0 -11
- package/commands/information-theory.md +0 -11
- package/commands/logic-deduction.md +0 -11
- package/commands/modeling.md +0 -11
- package/commands/optimization.md +0 -11
- package/commands/probability-statistics.md +0 -11
- package/commands/symmetry-invariance.md +0 -11
- package/commands/topological-thinking.md +0 -11
- package/commands/transformation.md +0 -11
- package/skills/abstraction/SKILL.en.md +0 -117
- package/skills/abstraction/SKILL.md +0 -121
- package/skills/abstraction/original-texts.en.md +0 -163
- package/skills/abstraction/original-texts.md +0 -175
- package/skills/algorithmic-thinking/SKILL.en.md +0 -132
- package/skills/algorithmic-thinking/SKILL.md +0 -138
- package/skills/algorithmic-thinking/original-texts.en.md +0 -253
- package/skills/algorithmic-thinking/original-texts.md +0 -256
- package/skills/axiomatization/SKILL.en.md +0 -144
- package/skills/axiomatization/SKILL.md +0 -151
- package/skills/axiomatization/original-texts.en.md +0 -154
- package/skills/axiomatization/original-texts.md +0 -160
- package/skills/causal-inference/SKILL.en.md +0 -147
- package/skills/causal-inference/SKILL.md +0 -151
- package/skills/causal-inference/original-texts.en.md +0 -136
- package/skills/causal-inference/original-texts.md +0 -167
- package/skills/discrete-combinatorial/SKILL.en.md +0 -124
- package/skills/discrete-combinatorial/SKILL.md +0 -131
- package/skills/discrete-combinatorial/original-texts.en.md +0 -184
- package/skills/discrete-combinatorial/original-texts.md +0 -185
- package/skills/game-theory/SKILL.en.md +0 -117
- package/skills/game-theory/SKILL.md +0 -123
- package/skills/game-theory/original-texts.en.md +0 -131
- package/skills/game-theory/original-texts.md +0 -131
- package/skills/induction-analogy/SKILL.en.md +0 -145
- package/skills/induction-analogy/SKILL.md +0 -152
- package/skills/induction-analogy/original-texts.en.md +0 -140
- package/skills/induction-analogy/original-texts.md +0 -154
- package/skills/information-theory/SKILL.en.md +0 -134
- package/skills/information-theory/SKILL.md +0 -140
- package/skills/information-theory/original-texts.en.md +0 -127
- package/skills/information-theory/original-texts.md +0 -127
- package/skills/logic-deduction/SKILL.en.md +0 -130
- package/skills/logic-deduction/SKILL.md +0 -135
- package/skills/logic-deduction/original-texts.en.md +0 -160
- package/skills/logic-deduction/original-texts.md +0 -173
- package/skills/modeling/SKILL.en.md +0 -135
- package/skills/modeling/SKILL.md +0 -139
- package/skills/modeling/original-texts.en.md +0 -162
- package/skills/modeling/original-texts.md +0 -165
- package/skills/optimization/SKILL.en.md +0 -129
- package/skills/optimization/SKILL.md +0 -135
- package/skills/optimization/original-texts.en.md +0 -167
- package/skills/optimization/original-texts.md +0 -168
- package/skills/probability-statistics/SKILL.en.md +0 -146
- package/skills/probability-statistics/SKILL.md +0 -151
- package/skills/probability-statistics/original-texts.en.md +0 -191
- package/skills/probability-statistics/original-texts.md +0 -193
- package/skills/symmetry-invariance/SKILL.en.md +0 -135
- package/skills/symmetry-invariance/SKILL.md +0 -139
- package/skills/symmetry-invariance/original-texts.en.md +0 -206
- package/skills/symmetry-invariance/original-texts.md +0 -221
- package/skills/topological-thinking/SKILL.en.md +0 -124
- package/skills/topological-thinking/SKILL.md +0 -128
- package/skills/topological-thinking/original-texts.en.md +0 -134
- package/skills/topological-thinking/original-texts.md +0 -164
- package/skills/transformation/SKILL.en.md +0 -120
- package/skills/transformation/SKILL.md +0 -124
- package/skills/transformation/original-texts.en.md +0 -204
- package/skills/transformation/original-texts.md +0 -216
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: probability-statistics
|
|
3
|
-
description: |
|
|
4
|
-
触发:问题涉及量化不确定性、概率分布、贝叶斯推断、假设检验、回归建模、实验设计、因果效应估计;或为随机算法/采样/量化/训练动力学设计概率机制时调用。
|
|
5
|
-
English: Trigger when a problem involves quantifying uncertainty, probability distributions, Bayesian inference, hypothesis testing, regression modeling, experimental design, causal effect estimation; or designing probabilistic mechanisms for random algorithms/sampling/quantization/training dynamics.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
> **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
|
|
9
|
-
|
|
10
|
-
# 🎲 概率与统计 / Probability & Statistics
|
|
11
|
-
|
|
12
|
-
> "不确定性是可量化的——概率不只是数学公式,而是理解随机世界的方式。量化不确定性,从数据中提取规律,做出理性的推断和决策。"
|
|
13
|
-
> "Uncertainty is quantifiable—probability is not just a mathematical formula, but a way to understand the random world. Quantifying uncertainty, extracting patterns from data, and making rational inferences and decisions."
|
|
14
|
-
>
|
|
15
|
-
> —— 概率论、数理统计
|
|
16
|
-
> —— Probability Theory, Mathematical Statistics
|
|
17
|
-
|
|
18
|
-
## 核心原则 / Core Principle
|
|
19
|
-
|
|
20
|
-
**世界充满不确定性。理性决策不是追求确定性,而是在不确定性中做出期望值最优的选择——概率是量化的信念,数据是量化的证据。**
|
|
21
|
-
|
|
22
|
-
> **数学形式化 / Mathematical Formalization**
|
|
23
|
-
>
|
|
24
|
-
> 概率空间 (Ω, 𝔽, P) 由 Kolmogorov 三公理定义:① **非负性** P(A) ≥ 0;② **规范性** P(Ω) = 1;③ **可数可加性** 对互不相交的可数事件族 Aᵢ,P(∪ᵢ Aᵢ) = Σᵢ P(Aᵢ)。由此推出互补律 P(Aᶜ)=1−P(A)、全概率公式 P(B)=Σᵢ P(B|Aᵢ)P(Aᵢ)。
|
|
25
|
-
>
|
|
26
|
-
> **贝叶斯更新**:P(θ|D) = P(D|θ)·P(θ)/P(D);先验 → 似然 → 后验,后验遇新数据成为新先验。
|
|
27
|
-
>
|
|
28
|
-
> **期望与方差**:E[X] = Σx·P(x)(离散)或 ∫x·f(x)dx(连续);Var(X) = E[(X−μ)²] = E[X²] − (E[X])²。
|
|
29
|
-
>
|
|
30
|
-
> **大数定律/CLT**:n → ∞ 时样本频率 f/n → P(A)、样本均值 X̄ → μ(依概率收敛);√n·(X̄ − μ)/σ →d N(0,1),故大量独立小因素叠加趋正态。
|
|
31
|
-
>
|
|
32
|
-
> **偏差-方差权衡**:总误差 = 偏差² + 方差 + σ²(不可约噪声)。
|
|
33
|
-
|
|
34
|
-
## GPU 友好性 / GPU-Friendliness(横切检查)
|
|
35
|
-
|
|
36
|
-
当概率方法用于**随机算法/采样/训练动力学设计**时,须过 `../../references/gpu-friendly-math.md` 八维门:
|
|
37
|
-
|
|
38
|
-
- **批量采样/蒙特卡洛**:i.i.d. 采样天然可并行、GEMM 友好(重参数化 Reparam、Gumbel-Softmax);低精度可行,注意 RNG 状态与跨设备一致性。
|
|
39
|
-
- **MLE / 对数似然**:逐元素似然可融合、可批量化(友好);softmax 交叉熵用 logsumexp 保数值稳定。
|
|
40
|
-
- **精确贝叶斯积分/边缘化**:高维 P(θ|D)∝P(D|θ)P(θ) 的归一化 Z=P(D) 与边缘化不可闭式 → 改造为 **MCMC(HMC/NUTS)/变分推断 ELBO**(见 `../../references/books/optimization-ml.md`)。
|
|
41
|
-
- **大表后验/协方差**:不可算 → mean-field / 低秩因子化近似(见 `../../references/books/matrix-analysis.md`)。
|
|
42
|
-
- **反模式**:逐样本串行 MCMC、需全局归一化的精确推断、"美但不可算"的高维积分。
|
|
43
|
-
|
|
44
|
-
八维最低判定(正式术语):**张量化**看样本、粒子、分布参数是否批量;**GEMM 可映射**看似然、回归、协方差是否落矩阵运算;**复杂度**看采样步数、积分维度、后验表规模;**显存与 KV-Cache**看粒子、协方差、充分统计是否可低秩/流式;**低精度稳定**检查 logsumexp、概率归一化、尾部概率;**并行与通信**看 RNG 与跨设备归约;**稀疏结构**看图模型/协方差是否结构化;**算子融合**看采样、打分、归一化能否融合。
|
|
45
|
-
|
|
46
|
-
> 配合 `../../references/books/optimization-ml.md`(变分/SAA/随机优化)与 `../../references/books/matrix-analysis.md`(协方差低秩)。
|
|
47
|
-
|
|
48
|
-
## 不适用场景 / When NOT to Use
|
|
49
|
-
|
|
50
|
-
- **确定性问题**(已知答案或可演绎推理得到)——不需要概率工具。
|
|
51
|
-
- **样本量极小(n < 5)且无法增加**——应报告数据本身而非推断。
|
|
52
|
-
- **纯粹的定性描述需求**——不需要数据分析。
|
|
53
|
-
- **因果机制已明确且无需概率建模**——直接用确定性因果链。
|
|
54
|
-
- **数据完全缺失或严重损坏**——无法做有意义的统计操作。
|
|
55
|
-
|
|
56
|
-
## 何时使用 / When to Use
|
|
57
|
-
|
|
58
|
-
- 审查论文/实验的统计方法是否正确、结论是否显著。
|
|
59
|
-
- 实验数据分析、显著性检验、效应量评估、回归建模与预测。
|
|
60
|
-
- 实验设计与功效分析(随机化、区组化、因子设计)。
|
|
61
|
-
- 因果效应估计(DAG + 后门准则 / do-演算)。
|
|
62
|
-
- 贝叶斯推断与先验-后验更新、拟合优度检验(χ²/F)。
|
|
63
|
-
- **为随机算法/采样/量化/训练动力学设计概率机制**(蒙特卡洛、重参数化、概率量化),并评估其 GPU 可行性。
|
|
64
|
-
|
|
65
|
-
## 方法流程 / Method
|
|
66
|
-
|
|
67
|
-
### 第一步:定义随机现象 / Define the Random Phenomenon
|
|
68
|
-
明确**随机变量 X**(要测量的量)、**样本空间 Ω**(所有可能结果)、**事件域 𝔽**(Ω 的 σ-代数:含 Ω、对补封闭、对可数并封闭)、**概率测度 P**: Ω→[0,1](满足 Kolmogorov 三公理)。区分离散与连续随机变量。
|
|
69
|
-
|
|
70
|
-
### 第二步:选择概率模型 / Choose the Probability Model
|
|
71
|
-
根据数据类型、样本量、物理机制选择分布:
|
|
72
|
-
|
|
73
|
-
| 分布 / Distribution | 适用场景 / Use Case | 关键参数 / Key Parameters |
|
|
74
|
-
|---|---|---|
|
|
75
|
-
| 二项 Binomial | N 次独立伯努利试验成功次数 | n, p |
|
|
76
|
-
| 泊松 Poisson | 单位时间/空间内稀有事件次数 | λ(平均发生率) |
|
|
77
|
-
| 正态 Normal | 大量独立小因素叠加(CLT) | μ, σ² |
|
|
78
|
-
| 指数 Exponential | 等待时间、无记忆性 P(X>t+s\|X>s)=P(X>t) | λ(速率) |
|
|
79
|
-
| 贝叶斯 Bayesian | 先验+似然→后验,逐步更新信念 | 先验参数,似然函数 |
|
|
80
|
-
| t-分布 Student's t | 小样本均值推断,尾部厚于正态 | df = n − 1 |
|
|
81
|
-
| χ²-分布 | 拟合优度检验、列联表、方差估计 | df |
|
|
82
|
-
| F-分布 | 比较两组方差、ANOVA | df₁, df₂ |
|
|
83
|
-
| 均匀 Uniform | 等概率事件、无先验默认 | a, b |
|
|
84
|
-
|
|
85
|
-
选择原则:离散/连续、大样本趋正态(小样本用 t)、物理机制(泊松=稀有独立事件、指数=等待时间)。
|
|
86
|
-
|
|
87
|
-
### 第三步:收集数据 / Collect Data
|
|
88
|
-
检查**样本量**是否足够(功效分析定最小 n)、**样本偏差**(选择/幸存者/自愿响应偏差)、**数据质量**(测量误差/缺失/异常值)、**收集方式**(随机抽样 vs 方便抽样)、**区组结构**。代表性比数据量更重要——有偏大样本比无偏小样本更危险。
|
|
89
|
-
|
|
90
|
-
### 第四步:统计推断 / Statistical Inference
|
|
91
|
-
**点估计/MLE** θ̂ = argmax_θ L(θ;x),L(θ;x)=f(x|θ),大样本下渐近正态、渐近有效;**置信区间**以置信水平(如 95%)给区间估计,频率解释为重复抽样时 95% 区间含真值;**假设检验** H₀ vs H₁,p-value = P(观察到此数据或更极端 \| H₀),p < α 拒绝 H₀;**贝叶斯更新** P(θ|D) = P(D|θ)·P(θ)/P(D)。
|
|
92
|
-
|
|
93
|
-
### 第五步:回归建模 / Regression Modeling
|
|
94
|
-
**线性回归** Y = β₀ + β₁X + ε, ε ~ N(0,σ²),最小二乘 β̂ = (XᵀX)⁻¹XᵀY,假设线性/独立/同方差/正态残差;**多元/逻辑回归** P(Y=1\|X) = 1/(1+e^(−(β₀+ΣβX))),MLE 估计输出概率;**模型选择** AIC = −2lnL + 2k(偏预测)、BIC = −2lnL + k·ln(n)(偏简约)、调整 R² = 1 − (1−R²)(n−1)/(n−k−1);**偏差-方差权衡** 总误差 = 偏差² + 方差 + σ²,交叉验证选复杂度。
|
|
95
|
-
|
|
96
|
-
### 第六步:实验设计 / Experimental Design
|
|
97
|
-
**随机化**使处理组与对照组在所有变量(已知/未知)上期望相等;**区组化**将相似单元分组、区组内比较减少混杂变异;**功效分析** Power = 1 − β = P(拒绝 H₀ \| H₁ 为真),给定效应量 δ、α 算所需最小 n,低功效 = 高假阴性;**因子设计** 2ᵏ 同时研究 k 因素及交互。
|
|
98
|
-
|
|
99
|
-
### 第七步:因果推理 / Causal Inference
|
|
100
|
-
**混淆变量** Z 同时影响 X 与 Y 使 P(Y\|X) ≠ P(Y\|do(X)),不调整则效应有偏;**DAG** 节点=变量、箭头=直接因果,识别后门/中介路径;**do-演算/后门准则** 若 S 阻断 X→Y 所有后门路径且不含 X 后代,则 P(Y\|do(X)) = Σₛ P(Y\|X,S=s)·P(S=s);**随机化**直接阻断所有后门路径,是因果效应估计的黄金标准。
|
|
101
|
-
|
|
102
|
-
### 第八步:解释结果 / Interpret Results
|
|
103
|
-
区分**统计显著**与**实际显著**(p<0.05 ≠ 效应大,大样本下微小差异也"显著")。报告**效应量**:Cohen's d = (μ₁−μ₂)/σ、odds ratio = (P₁/(1−P₁))/(P₂/(1−P₂))。注意**相关≠因果**(P(Y\|X) ≠ P(Y\|do(X)))、**多重比较**(m 个检验期望假阳性 = m·α,需 Bonferroni α_adj=α/m 或 BH-FDR 校正)。
|
|
104
|
-
|
|
105
|
-
### 第九步:量化不确定性 / Quantify Uncertainty
|
|
106
|
-
给出**置信区间**(频率:重复抽样覆盖率)或**可信区间**(贝叶斯:参数在此区间的概率);说明结论可靠性与统计功效;识别剩余不确定性来源(模型假设、测量误差、未观测混淆);报告效应量区间而非仅点估计。
|
|
107
|
-
|
|
108
|
-
## 常见错误 / Common Errors
|
|
109
|
-
|
|
110
|
-
| 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
|
|
111
|
-
|---|---|---|
|
|
112
|
-
| 把 p-value 当真理 | p=0.05 不表示"95% 把握",而是 H₀ 下观察到该数据或更极端的概率 | 理解 p = P(数据或更极端 \| H₀) |
|
|
113
|
-
| 混淆概率与频率 | 概率是理论值 P(A),频率是经验值 f(A)/n | 用大数定律连接:n→∞ 时 f/n → P |
|
|
114
|
-
| 忽视先验概率 | 基础率忽视:只看新证据不看背景概率,罕见病检验尤其危险 | 贝叶斯:P(H\|E) = P(E\|H)·P(H)/P(E) |
|
|
115
|
-
| 幸存者偏差 | 只看成功者,样本空间被截断 | 考虑完整样本空间 Ω,含失败样本 |
|
|
116
|
-
| 小样本陷阱 | n=3 的"规律"不可信,方差估计不稳定 | 检查样本量、算功效、用 t 分布 |
|
|
117
|
-
| 相关当因果 | 两变量相关 ≠ 一者导致另一者 | 找混淆变量,DAG + 后门准则 |
|
|
118
|
-
| 忽视回归均值 | 极端表现后倾向回归平均 E[X] | 用回归分析而非直觉判断趋势 |
|
|
119
|
-
| 小样本用正态而非 t | n<30 时正态近似低估不确定性 | n<30 用 t 分布,df=n−1 |
|
|
120
|
-
| 混淆 AIC 与 BIC | AIC 偏拟合、BIC 偏简约 | 预测用 AIC,解释用 BIC |
|
|
121
|
-
| 观测数据推断因果 | 无随机化时混淆无法消除,P(Y\|X) ≠ P(Y\|do(X)) | DAG + 后门准则调整,或只断关联 |
|
|
122
|
-
| 忽略多重比较校正 | m 个检验期望假阳性 = m·α | Bonferroni α/m 或 BH-FDR |
|
|
123
|
-
| 忽略功效与效应量 | 低功效即使有真实效应也不显著;只报 p 不报效应量 | 设计前算样本量,报 Cohen's d / odds ratio |
|
|
124
|
-
| 精确积分/大表后验不可算 | 高维归一化 Z=P(D) 与边缘化无闭式,逐样本串行 MCMC 不可并行 | 改用 MCMC/变分 ELBO/低秩近似,过 GPU 八维门 |
|
|
125
|
-
|
|
126
|
-
## 操作规程 / Operating Procedure
|
|
127
|
-
|
|
128
|
-
当本 skill 被触发时,输出必须包含:
|
|
129
|
-
|
|
130
|
-
1. **随机变量定义**:`[变量]: [含义] [类型: 离散/连续]`,指定样本空间 Ω 与事件域 𝔽
|
|
131
|
-
2. **概率模型**:`[分布]: [选择] 因为 [理由]`,注明 df 或关键参数
|
|
132
|
-
3. **数据评估**:`[样本量]: N, [偏差检查]: [结果], [收集方式]: [随机/方便]`
|
|
133
|
-
4. **统计推断**:`[估计值]: [θ̂], [置信区间]: [a,b], [p-value]: [值], [方法]: [MLE/Bayesian]`
|
|
134
|
-
5. **回归/实验设计(如适用)**:`[模型]: [线性/逻辑] [系数]: [β̂] [准则]: [AIC/BIC]`;`[设计]: [随机化/区组/因子] [功效]: [Power] [最小n]: [n]`
|
|
135
|
-
6. **因果评估(如适用)**:`[DAG]: [路径], [混淆]: [列表], [调整集]: [S], [因果效应]: [P(Y\|do(X))]`
|
|
136
|
-
7. **效应量与不确定性**:Cohen's d / odds ratio 及其区间,统计功效与剩余不确定性
|
|
137
|
-
8. **偏差检查**:逐一核对常见错误表,标注 `✅ 无` 或 `⚠️ 发现 [问题]`
|
|
138
|
-
9. **[GPU 可行性]**(若用于随机算法/采样/训练):推断是否需采样/变分近似,过八维门,标注友好/可改造/反模式 + 改造建议
|
|
139
|
-
10. **行动建议**:明确写出"接下来我将……"
|
|
140
|
-
|
|
141
|
-
**输出不得只给分析而无结论。**
|
|
142
|
-
|
|
143
|
-
## 与其他 skill 的关系 / Relations to Other Skills
|
|
144
|
-
|
|
145
|
-
- **建模思想**:概率模型是建模的重要工具——不确定性需要概率框架。
|
|
146
|
-
- **优化思想**:不确定性下的优化需期望值优化或鲁棒优化;随机优化/SAA 把期望目标转为确定性近似。
|
|
147
|
-
- **归纳与类比**:从数据中发现规律本质是归纳推理的概率版本。
|
|
148
|
-
- **逻辑演绎**:经典逻辑是确定性的,概率逻辑是不确定性的推广。
|
|
149
|
-
- **因果推断思想**:P(Y\|X) 是统计关联,P(Y\|do(X)) 是因果效应;因果需机制假设(DAG),不能纯靠数据得出。
|
|
150
|
-
- **信息论思想**:熵 H(X)=−ΣP(x)lnP(x) 量化不确定性;信息增益 I(X;Y)=H(X)−H(X\|Y);最大熵原则在约束下选使熵最大的分布。
|
|
151
|
-
- **现代数学激活**:`../../references/books/optimization-ml.md`(随机优化/SAA、变分推断 ELBO)、`../../references/books/matrix-analysis.md`(协方差低秩、因子化近似)。
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
# Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## Bayes' Theorem (Bayes, 1763)
|
|
4
|
-
|
|
5
|
-
> P(H|E) = P(E|H) × P(H) / P(E)
|
|
6
|
-
>
|
|
7
|
-
> Posterior = Likelihood × Prior / Evidence
|
|
8
|
-
|
|
9
|
-
**Meaning**: When we observe new evidence E, our belief about hypothesis H is updated from the prior P(H) to the posterior P(H|E).
|
|
10
|
-
|
|
11
|
-
**The core of Bayesian thinking**:
|
|
12
|
-
1. Start with a belief (prior probability)
|
|
13
|
-
2. Observe data (evidence)
|
|
14
|
-
3. Update the belief (posterior probability)
|
|
15
|
-
4. Repeat the process
|
|
16
|
-
|
|
17
|
-
**Mathematical background**: Thomas Bayes's paper "An Essay towards solving a Problem in the Doctrine of Chances" was published posthumously in 1763 by Richard Price. Bayes' theorem is essentially a rearrangement of the definition of conditional probability P(A∩B) = P(A|B)P(B) = P(B|A)P(A), yet its philosophical significance far transcends the mathematics itself — it provides a rigorous mathematical framework for "learning from data."
|
|
18
|
-
|
|
19
|
-
## Law of Large Numbers (Bernoulli, 1713)
|
|
20
|
-
|
|
21
|
-
> As the number of trials n approaches infinity, the sample mean converges in probability to the expected value.
|
|
22
|
-
|
|
23
|
-
**Meaning**: A single observation is unreliable, but a large number of observations reveals the true pattern. This is the theoretical foundation of statistical inference.
|
|
24
|
-
|
|
25
|
-
**Mathematical background**: Jacob Bernoulli proved the weak law of large numbers in *Ars Conjectandi* (1713): for any ε>0, P(|X̄ₙ - μ| ≥ ε) → 0. Borel (1909) and Kolmogorov subsequently strengthened this to the strong law of large numbers — almost sure convergence: P(lim X̄ₙ = μ) = 1.
|
|
26
|
-
|
|
27
|
-
## Central Limit Theorem (De Moivre-Laplace, 1733 – Lindeberg-Feller, 20th century)
|
|
28
|
-
|
|
29
|
-
> The sum of a large number of i.i.d. random variables is approximately normally distributed, regardless of the original distribution.
|
|
30
|
-
|
|
31
|
-
**Meaning**: The normal distribution is ubiquitous because it is the natural result of "the superposition of many small factors."
|
|
32
|
-
|
|
33
|
-
**Mathematical background**: De Moivre (1733) first discovered the normal approximation to the binomial distribution; Laplace (1810) generalized it to the general case. The Lindeberg-Feller conditions give the most precise convergence conditions for independent but non-identically distributed settings. Lyapunov (1901) introduced the characteristic function approach, which became a core tool of modern probability theory.
|
|
34
|
-
|
|
35
|
-
## Kolmogorov Axioms (1933)
|
|
36
|
-
|
|
37
|
-
> The foundational axioms of probability theory:
|
|
38
|
-
> 1. Non-negativity: P(A) ≥ 0
|
|
39
|
-
> 2. Normalization: P(Ω) = 1
|
|
40
|
-
> 3. Countable additivity: If A₁, A₂, ... are mutually disjoint, then P(∪Aₖ) = ΣP(Aₖ)
|
|
41
|
-
|
|
42
|
-
**Meaning**: Probability is defined as a measure — probability theory thereby became a rigorous branch of mathematics rather than a collection of empirical rules.
|
|
43
|
-
|
|
44
|
-
**Mathematical background**: In *Grundbegriffe der Wahrscheinlichkeitsrechnung* (1933), Andrey Kolmogorov embedded probability theory within the measure-theoretic framework (Ω, F, P), i.e., the triple of sample space, event space (σ-algebra), and probability measure. This axiomatization gave precise definitions to concepts such as the law of large numbers, conditional probability, and random variables, and is the cornerstone of modern probability theory.
|
|
45
|
-
|
|
46
|
-
## Neyman-Pearson Lemma (1928/1933)
|
|
47
|
-
|
|
48
|
-
> At a given significance level α, the likelihood ratio test is the most powerful test:
|
|
49
|
-
> Reject H₀ when L(x|H₁)/L(x|H₀) > k, where k is determined by α.
|
|
50
|
-
|
|
51
|
-
**Meaning**: Statistical testing is not a matter of subjective judgment; it can be made optimal under the constraint of "controlling the probability of error."
|
|
52
|
-
|
|
53
|
-
**Mathematical background**: Jerzy Neyman and Egon Pearson systematized hypothesis testing theory between 1928 and 1933, introducing the concepts of Type I error (α, false positive), Type II error (β, false negative), and test power (power = 1-β). The Neyman-Pearson lemma proves the optimality of the likelihood ratio test in the simple-vs-simple hypothesis setting. This framework became the standard paradigm for modern statistical testing.
|
|
54
|
-
|
|
55
|
-
## Fisher's Statistical Inference (1920s–1930s)
|
|
56
|
-
|
|
57
|
-
- **Maximum likelihood estimation**: Choose the parameter θ̂ = argmax L(θ; x) that maximizes the probability of observing the data
|
|
58
|
-
- **p-value**: The probability of observing the current or more extreme data under the assumption that the null hypothesis is true
|
|
59
|
-
- **Significance testing**: Deciding whether to reject the null hypothesis via the p-value
|
|
60
|
-
- **Sufficiency principle**: A statistic T(X) is sufficient if P(X|T) does not depend on θ
|
|
61
|
-
|
|
62
|
-
**Mathematical background**: R.A. Fisher's contributions extend far beyond the p-value. He proposed criteria for evaluating estimators such as consistency and efficiency; Fisher information I(θ) = E[(∂log L/∂θ)²] measures the information content of data about the parameter and is closely linked to the Cramér-Rao lower bound: Var(θ̂) ≥ 1/I(θ).
|
|
63
|
-
|
|
64
|
-
## Fisher's Experimental Design (1935)
|
|
65
|
-
|
|
66
|
-
> Randomization does not ignore causality — it makes causal inference possible.
|
|
67
|
-
|
|
68
|
-
**Meaning**: The credibility of a scientific experiment comes not from "precise control" but from "random assignment."
|
|
69
|
-
|
|
70
|
-
**Mathematical background**: In *The Design of Experiments* (1935), Fisher proposed three fundamental principles — randomization, blocking, and factorial designs. Randomization ensures that estimates of treatment effects are free from systematic bias; blocking controls for known nuisance variables; factorial designs such as 2² and 2³ allow simultaneous estimation of multiple main effects and interaction effects, far more efficient than one-factor-at-a-time experimentation.
|
|
71
|
-
|
|
72
|
-
## Student's t-Distribution (Gosset, 1908)
|
|
73
|
-
|
|
74
|
-
> When the sample size n is small and the population standard deviation is unknown:
|
|
75
|
-
> t = (X̄ - μ) / (S/√n), which follows a t(n-1) distribution.
|
|
76
|
-
|
|
77
|
-
**Meaning**: Small samples cannot be approximated directly by the normal distribution — the t-distribution has heavier tails, reflecting the additional uncertainty from estimating the standard deviation itself.
|
|
78
|
-
|
|
79
|
-
**Mathematical background**: William Sealy Gosset published this result under the pen name "Student" in 1908. He worked at the Guinness brewery and could not use his real name due to confidentiality requirements. The t-distribution is the ratio of a standard normal to √(χ²/(n-1)), and converges to the normal distribution as n→∞. Fisher (1925) provided a rigorous proof and generalized the result.
|
|
80
|
-
|
|
81
|
-
## Chi-Squared Test (Karl Pearson, 1900)
|
|
82
|
-
|
|
83
|
-
> χ² = Σ(Oₖ - Eₖ)² / Eₖ, which approximately follows a χ²(k-1-p) distribution under the null hypothesis.
|
|
84
|
-
|
|
85
|
-
**Meaning**: Does the discrepancy between observed and expected frequencies exceed what can be explained by random fluctuation?
|
|
86
|
-
|
|
87
|
-
**Mathematical background**: Karl Pearson proposed the goodness-of-fit test in 1900, the first formal statistical test. The degrees-of-freedom correction to k-1-p (where k is the number of categories and p is the number of estimated parameters) was completed by Fisher (1922). The χ² test is widely used in contingency table independence testing, distribution fitting, and related areas.
|
|
88
|
-
|
|
89
|
-
## Regression and Least Squares (Legendre 1805, Gauss 1809)
|
|
90
|
-
|
|
91
|
-
> min Σ(yₖ - (a + bxₖ))² → least squares estimate β̂ = (X'X)⁻¹X'y
|
|
92
|
-
|
|
93
|
-
**Meaning**: Among all fitted lines, least squares minimizes the sum of squared residuals; under the assumption of normal errors, it is equivalent to maximum likelihood estimation.
|
|
94
|
-
|
|
95
|
-
**Mathematical background**: Legendre (1805) was the first to publish the method of least squares; Gauss (1809) claimed to have used the method as early as 1795 and provided a probabilistic argument under the normal error assumption. The term "regression" was coined by Galton (1886) in his study of the intergenerational regression of height. The modern linear regression model Y = Xβ + ε is the core framework of statistical modeling.
|
|
96
|
-
|
|
97
|
-
## Markov Chains (Markov, 1906)
|
|
98
|
-
|
|
99
|
-
> P(Xₙ₊₁ = j | Xₙ = i, Xₙ₋₁, ...) = P(Xₙ₊₁ = j | Xₙ = i)
|
|
100
|
-
>
|
|
101
|
-
> The future depends only on the present, not on the past — the memoryless property.
|
|
102
|
-
|
|
103
|
-
**Meaning**: Many real-world processes have the property that "the current state determines the future trajectory," and historical details can be disregarded.
|
|
104
|
-
|
|
105
|
-
**Mathematical background**: Andrey Markov (1906) first defined Markov chains by studying vowel/consonant sequences in Pushkin's *Eugene Onegin*. The ergodic theorem guarantees that for an irreducible, aperiodic, positive recurrent chain, π(j) = lim P(Xₙ = j) exists and is the unique stationary distribution. Markov chains are the theoretical foundation of MCMC (Metropolis 1943, Hastings 1970, Gelfand-Smith 1990) and also underpin Google PageRank (Brin-Page 1998).
|
|
106
|
-
|
|
107
|
-
## Stochastic Processes (Brownian Motion, Wiener Process)
|
|
108
|
-
|
|
109
|
-
> W(t) satisfies: (1) W(0)=0, (2) W(t)-W(s) ~ N(0, t-s), (3) independent increments, (4) continuous paths
|
|
110
|
-
|
|
111
|
-
**Meaning**: Brownian motion is the macroscopic mathematical model of microscopic random fluctuations — from pollen motion to stock price fluctuations.
|
|
112
|
-
|
|
113
|
-
**Mathematical background**: Brown (1827) observed the irregular motion of pollen particles; Bachelier (1900) was the first to use it to model stock prices; Wiener (1923) gave the rigorous mathematical construction. Itô (1944) developed stochastic integration dX = μdt + σdW and Itô's formula, which became the theoretical foundation of financial mathematics (Black-Scholes 1973) and stochastic differential equations.
|
|
114
|
-
|
|
115
|
-
## Shannon Information Theory (1948)
|
|
116
|
-
|
|
117
|
-
> H(X) = -Σ p(x) log p(x) — entropy, the measure of uncertainty of a random variable
|
|
118
|
-
> I(X;Y) = H(X) - H(X|Y) — mutual information, the amount of information Y provides about X
|
|
119
|
-
> C = max I(X;Y) — channel capacity, the upper bound on the rate of reliable communication
|
|
120
|
-
|
|
121
|
-
**Meaning**: Information can be quantified; the fundamental limits of communication are determined by mathematical laws, not by engineering technology.
|
|
122
|
-
|
|
123
|
-
**Mathematical background**: Claude Shannon founded information theory in "A Mathematical Theory of Communication" (1948). The source coding theorem: average code length ≥ H(X); the channel coding theorem: when the transmission rate R < C, reliable coding schemes exist. The deep connection between entropy and probability — H(X) = -E[log p(X)] — makes information theory a natural extension of probability theory.
|
|
124
|
-
|
|
125
|
-
## Pearl's Causal Inference (2000)
|
|
126
|
-
|
|
127
|
-
> The causal hierarchy:
|
|
128
|
-
> 1. Association P(y|x) — seeing
|
|
129
|
-
> 2. Intervention P(y|do(x)) — doing
|
|
130
|
-
> 3. Counterfactual P(yₓ|x', y') — imagining
|
|
131
|
-
|
|
132
|
-
**Meaning**: Causality is not a strengthened version of association — "do(x)" and "observe x" are mathematically distinct.
|
|
133
|
-
|
|
134
|
-
**Mathematical background**: In *Causality* (2000), Judea Pearl systematized causal inference using directed acyclic graphs (DAGs) and the do-calculus. The three rules of the do-calculus allow transformation of interventional probabilities among observable variables; the front-door and back-door criteria specify conditions under which causal effects can be computed from observational data. Causal inference answers "what would happen to y if I did x," which goes beyond the expressive power of probability theory alone.
|
|
135
|
-
|
|
136
|
-
## Bootstrap (Efron, 1979)
|
|
137
|
-
|
|
138
|
-
> Resample with replacement from X₁,...,Xₙ a total of B times to obtain B bootstrap samples;
|
|
139
|
-
> use the bootstrap distribution to approximate the true distribution.
|
|
140
|
-
|
|
141
|
-
**Meaning**: When theoretical derivation is difficult, use the data itself to simulate the sampling process — "validate yourself with yourself."
|
|
142
|
-
|
|
143
|
-
**Mathematical background**: Bradley Efron (1979) proposed the bootstrap; its theoretical guarantees were established by Bickel-Freedman (1981) and Singh (1981): under mild conditions, the bootstrap distribution converges uniformly to the true sampling distribution. The bootstrap can estimate standard errors, confidence intervals (percentile method / BCa method), p-values, and more, making it a general-purpose tool for nonparametric inference.
|
|
144
|
-
|
|
145
|
-
## Bayesian vs Frequentist Debate
|
|
146
|
-
|
|
147
|
-
> Bayesian: Probability is degree of belief; parameter θ is a random variable → P(θ|data)
|
|
148
|
-
> Frequentist: Probability is long-run frequency; parameter θ is a fixed unknown constant → sampling distribution of the estimator θ̂
|
|
149
|
-
|
|
150
|
-
**Meaning**: This is not a technical disagreement but a philosophical one about "what probability is."
|
|
151
|
-
|
|
152
|
-
**Core comparison**:
|
|
153
|
-
- Bayesian: Prior + Likelihood → Posterior; naturally suited to sequential updating and small samples
|
|
154
|
-
- Frequentist: Unbiasedness, consistency, power; naturally suited to large-scale repeatable experiments
|
|
155
|
-
- In practice: Bayesian methods dominate in machine learning and causal inference; frequentist methods dominate in clinical trials and quality control
|
|
156
|
-
|
|
157
|
-
**Mathematical background**: The debate has continued from Laplace vs Fisher to the present day. Jeffreys (1939) proposed the non-informative prior p(θ) ∝ |I(θ)|^(1/2); de Finetti (1937) proved that coherence of subjective probability is equivalent to additivity; Bernardo-Smith (1994) developed reference prior theory.
|
|
158
|
-
|
|
159
|
-
## Monty Hall Problem
|
|
160
|
-
|
|
161
|
-
> Three doors, one with a prize. You choose one; the host opens another, revealing it to be empty.
|
|
162
|
-
> Question: Should you switch doors? Answer: switching wins with probability 2/3; staying wins with probability 1/3.
|
|
163
|
-
|
|
164
|
-
**Meaning**: Intuition fails here — the host's action conveys information (he avoids opening the door with the prize).
|
|
165
|
-
|
|
166
|
-
**Mathematical background**: This problem is an excellent introduction to Bayesian thinking. By Bayes' theorem: P(prize behind remaining door | host opened empty door) = 2/3, because the host selectively avoids the prize, which is itself information. Analogous structures appear in medical diagnosis and legal reasoning — "selective observation" alters probabilities.
|
|
167
|
-
|
|
168
|
-
## Common Statistical Fallacies and Cognitive Biases
|
|
169
|
-
|
|
170
|
-
**Survivorship Bias**:
|
|
171
|
-
During World War II, the military analyzed bullet-hole distributions on returning aircraft and found the most holes on the wings, recommending reinforcement of the wings. Statistician Abraham Wald pointed out: the areas without bullet holes should be reinforced — because the planes hit in those areas never came back. Wald's insight is essentially about conditional probability: the observed data are conditioned on "the aircraft returned," not the full data set.
|
|
172
|
-
|
|
173
|
-
**Base Rate Neglect**:
|
|
174
|
-
A rare disease has a prevalence of 0.1%, and the diagnostic test has 99% accuracy. If you test positive, what is the probability you actually have the disease?
|
|
175
|
-
- Intuitive answer: 99%
|
|
176
|
-
- Bayesian calculation: P(disease|positive) = 0.99 × 0.001 / (0.99 × 0.001 + 0.01 × 0.999) ≈ 9%
|
|
177
|
-
- The prior probability (base rate) is severely underestimated by intuition
|
|
178
|
-
|
|
179
|
-
**Regression to the Mean**:
|
|
180
|
-
Individuals who perform exceptionally well tend to be closer to average on the next measurement, not because of "declining ability" but because extreme performance is partly due to luck. Galton (1886) found that children of tall parents tend to be shorter than their parents — this is not "degeneration" but a statistical law.
|
|
181
|
-
|
|
182
|
-
## The Value of Probabilistic Thinking in Everyday Life
|
|
183
|
-
|
|
184
|
-
> "The core of probabilistic thinking is not computing exact probabilities, but cultivating the habit of 'thinking under uncertainty.'"
|
|
185
|
-
|
|
186
|
-
- Don't be swayed by a single anecdote — consider the base rate
|
|
187
|
-
- Update your beliefs when new information arrives — Bayesian updating
|
|
188
|
-
- Distinguish signal from noise — the law of large numbers
|
|
189
|
-
- Be wary of extreme values — regression to the mean
|
|
190
|
-
- Distinguish "seeing" from "doing" — the causal hierarchy (Pearl)
|
|
191
|
-
- Quantify uncertainty — entropy and information (Shannon)
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
# 数学出处与经典文献 / Mathematical Sources and Classic Texts
|
|
2
|
-
|
|
3
|
-
## 贝叶斯定理 / Bayes' Theorem (Bayes, 1763)
|
|
4
|
-
|
|
5
|
-
> P(H|E) = P(E|H) × P(H) / P(E)
|
|
6
|
-
>
|
|
7
|
-
> 后验概率 = 似然 × 先验概率 / 证据
|
|
8
|
-
|
|
9
|
-
**含义**:当我们观察到新证据 E 时,我们关于假设 H 的信念从先验 P(H) 更新为后验 P(H|E)。
|
|
10
|
-
|
|
11
|
-
**贝叶斯思维的核心**:
|
|
12
|
-
1. 先有信念(先验概率)
|
|
13
|
-
2. 观察数据(证据)
|
|
14
|
-
3. 更新信念(后验概率)
|
|
15
|
-
4. 重复这个过程
|
|
16
|
-
|
|
17
|
-
**数学背景**:Thomas Bayes 的论文 "An Essay towards solving a Problem in the Doctrine of Chances" 于 1763 年由 Richard Price 代为发表。贝叶斯定理本质上是条件概率的定义 P(A∩B) = P(A|B)P(B) = P(B|A)P(A) 的重排,但其哲学意义远超数学本身——它为"从数据学习"提供了严格的数学框架。
|
|
18
|
-
|
|
19
|
-
## 大数定律 / Law of Large Numbers (Bernoulli, 1713)
|
|
20
|
-
|
|
21
|
-
> 当试验次数 n 趋于无穷时,样本均值依概率收敛于期望值。
|
|
22
|
-
> As the number of trials n approaches infinity, the sample mean converges in probability to the expected value.
|
|
23
|
-
|
|
24
|
-
**含义**:单次观察不可赖,但大量观察会揭示真实规律。这是统计推断的理论基础。
|
|
25
|
-
|
|
26
|
-
**数学背景**:Jacob Bernoulli 在《Ars Conjectandi》(1713) 中证明了弱大数定律:对任意 ε>0, P(|X̄ₙ - μ| ≥ ε) → 0。Borel (1909) 与 Kolmogorov 进一步强化为强大数定律——几乎必然收敛:P(lim X̄ₙ = μ) = 1。
|
|
27
|
-
|
|
28
|
-
## 中心极限定理 / Central Limit Theorem (De Moivre-Laplace, 1733–Lindeberg-Feller, 20世纪)
|
|
29
|
-
|
|
30
|
-
> 大量独立同分布随机变量的和近似服从正态分布,无论原始分布是什么。
|
|
31
|
-
> The sum of a large number of i.i.d. random variables is approximately normally distributed, regardless of the original distribution.
|
|
32
|
-
|
|
33
|
-
**含义**:正态分布之所以普遍,是因为它是"大量小因素叠加"的自然结果。
|
|
34
|
-
|
|
35
|
-
**数学背景**:De Moivre (1733) 首先发现二项分布的正态近似;Laplace (1810) 推广到一般情形。Lindeberg-Feller 条件给出最精确的独立但非同分布情形的收敛条件。Lyapunov (1901) 引入特征函数证明方法,成为现代概率论的核心工具。
|
|
36
|
-
|
|
37
|
-
## Kolmogorov 公理化体系 / Kolmogorov Axioms (1933)
|
|
38
|
-
|
|
39
|
-
> 概率论的基础公理:
|
|
40
|
-
> 1. 非负性:P(A) ≥ 0
|
|
41
|
-
> 2. 规范性:P(Ω) = 1
|
|
42
|
-
> 3. 可加性:若 A₁, A₂, ... 互不相交,则 P(∪Aₖ) = ΣP(Aₖ)
|
|
43
|
-
|
|
44
|
-
**含义**:概率被定义为测度——概率论从此成为严格的数学分支,而非经验规则集合。
|
|
45
|
-
|
|
46
|
-
**数学背景**:Andrey Kolmogorov 在《Grundbegriffe der Wahrscheinlichkeitsrechnung》(1933) 中将概率论嵌入测度论框架 (Ω, F, P),即样本空间、事件域(σ-代数)与概率测度三元组。这一公理化使大数定律、条件概率、随机变量等概念获得精确定义,是现代概率论的基石。
|
|
47
|
-
|
|
48
|
-
## Neyman-Pearson 检验理论 / Neyman-Pearson Lemma (1928/1933)
|
|
49
|
-
|
|
50
|
-
> 在给定显著性水平 α 下,似然比检验是最强大的检验:
|
|
51
|
-
> 拒绝 H₀ 当 L(x|H₁)/L(x|H₀) > k,其中 k 由 α 决定。
|
|
52
|
-
|
|
53
|
-
**含义**:统计检验不是主观判断,而是可以在"控制犯错概率"的前提下达到最优。
|
|
54
|
-
|
|
55
|
-
**数学背景**:Jerzy Neyman 与 Egon Pearson 在 1928–1933 年间系统化了假设检验理论,引入 Type I 错误(α,假阳性)与 Type II 错误(β,假阴性)、检验功效 (power = 1-β) 等概念。Neyman-Pearson 引理证明了简单假设 vs 简单假设情形下似然比检验的最优性。这一框架成为现代统计检验的标准范式。
|
|
56
|
-
|
|
57
|
-
## Fisher 统计推断体系 / Fisher's Statistical Inference (1920s–1930s)
|
|
58
|
-
|
|
59
|
-
- **最大似然估计**:选择使观测数据出现概率最大的参数 θ̂ = argmax L(θ; x)
|
|
60
|
-
- **p-value**:在原假设为真的条件下,观察到当前或更极端数据的概率
|
|
61
|
-
- **显著性检验**:通过 p-value 判断是否拒绝原假设
|
|
62
|
-
- **充分性原则**:统计量 T(X) 是充分的,若 P(X|T) 不依赖于 θ
|
|
63
|
-
|
|
64
|
-
**数学背景**:R.A. Fisher 的贡献远不止 p-value。他提出一致性、有效性等估计量评价准则; Fisher 信息量 I(θ) = E[(∂log L/∂θ)²] 度量数据对参数的信息含量,与 Cramér-Rao 下界紧密关联:Var(θ̂) ≥ 1/I(θ)。
|
|
65
|
-
|
|
66
|
-
## Fisher 实验设计 / Fisher's Experimental Design (1935)
|
|
67
|
-
|
|
68
|
-
> 随机化不是忽视因果,而是使因果推断成为可能。
|
|
69
|
-
|
|
70
|
-
**含义**:科学实验的可信度不来自"精密控制",而来自"随机分配"。
|
|
71
|
-
|
|
72
|
-
**数学背景**:Fisher 在《The Design of Experiments》(1935) 中提出三大原则——随机化 (randomization)、区组化 (blocking)、复因子设计 (factorial designs)。随机化使处理效应的估计免受系统偏差;区组化控制已知干扰变量;2²、2³ 等因子设计可同时估计多个主效应与交互效应,效率远超逐一试验。
|
|
73
|
-
|
|
74
|
-
## Student t 分布 / Student's t-Distribution (Gosset, 1908)
|
|
75
|
-
|
|
76
|
-
> 当样本量 n 较小且总体标准差未知时:
|
|
77
|
-
> t = (X̄ - μ) / (S/√n),服从 t(n-1) 分布。
|
|
78
|
-
|
|
79
|
-
**含义**:小样本不能直接用正态近似——t 分布的尾部更厚,反映了估计标准差本身的不确定性。
|
|
80
|
-
|
|
81
|
-
**数学背景**:William Sealy Gosset 以 "Student" 为笔名在 1908 年发表此结果。他在 Guinness 啤酒厂工作,因保密要求无法署真名。t 分布是标准正态与 χ²/(n-1) 的比值分布,当 n→∞ 时趋于正态。Fisher (1925) 给出了严格证明并将其推广。
|
|
82
|
-
|
|
83
|
-
## χ² 检验 / Chi-Squared Test (Karl Pearson, 1900)
|
|
84
|
-
|
|
85
|
-
> χ² = Σ(Oₖ - Eₖ)² / Eₖ,在原假设下近似服从 χ²(k-1-p) 分布。
|
|
86
|
-
|
|
87
|
-
**含义**:观测频率与期望频率之间的差异是否超过随机波动所能解释的范围?
|
|
88
|
-
|
|
89
|
-
**数学背景**:Karl Pearson 在 1900 年提出拟合优度检验,这是第一个正式的统计检验方法。自由度 = k-1-p(k 为类别数,p 为估计参数数)的修正由 Fisher (1922) 完成。χ² 检验在列联表独立性检验、分布拟合等领域广泛应用。
|
|
90
|
-
|
|
91
|
-
## 回归与最小二乘法 / Regression and Least Squares (Legendre 1805, Gauss 1809)
|
|
92
|
-
|
|
93
|
-
> min Σ(yₖ - (a + bxₖ))² → 最小二乘估计 β̂ = (X'X)⁻¹X'y
|
|
94
|
-
|
|
95
|
-
**含义**:在所有拟合直线中,最小二乘使残差平方和最小;在正态误差假设下,它等价于最大似然估计。
|
|
96
|
-
|
|
97
|
-
**数学背景**:Legendre (1805) 首先发表最小二乘法;Gauss (1809) 声称自己早在 1795 年就已使用该方法,并给出正态误差假设下的概率论证。"回归"一词由 Galton (1886) 提出,研究身高代际回归现象。现代线性回归模型 Y = Xβ + ε 是统计建模的核心框架。
|
|
98
|
-
|
|
99
|
-
## Markov 链 / Markov Chains (Markov, 1906)
|
|
100
|
-
|
|
101
|
-
> P(Xₙ₊₁ = j | Xₙ = i, Xₙ₋₁, ...) = P(Xₙ₊₁ = j | Xₙ = i)
|
|
102
|
-
>
|
|
103
|
-
> 未来只依赖现在,不依赖过去——无记忆性 (memoryless property)。
|
|
104
|
-
|
|
105
|
-
**含义**:许多真实过程具有"当前状态决定未来走向"的性质,历史细节可以忽略。
|
|
106
|
-
|
|
107
|
-
**数学背景**:Andrey Markov (1906) 通过研究普希金《叶甫盖尼·奥涅金》中元音/辅音序列,首次定义了 Markov 链。遍历定理保证:对不可约、非周期、正常返链,π(j) = lim P(Xₙ = j) 存在且为唯一平稳分布。Markov 链是 MCMC (Metropolis 1943, Hastings 1970, Gelfand-Smith 1990) 的理论基础,也支撑 Google PageRank (Brin-Page 1998)。
|
|
108
|
-
|
|
109
|
-
## 随机过程 / Stochastic Processes (Brownian Motion, Wiener Process)
|
|
110
|
-
|
|
111
|
-
> W(t) 满足:(1) W(0)=0, (2) W(t)-W(s) ~ N(0, t-s), (3) 独立增量, (4) 连续路径
|
|
112
|
-
|
|
113
|
-
**含义**:布朗运动是微观随机涨落的宏观数学模型——从花粉运动到股价波动。
|
|
114
|
-
|
|
115
|
-
**数学背景**:Brown (1827) 观察花粉微粒的无规则运动;Bachelier (1900) 首先用其模型化股价;Wiener (1923) 给出严格数学构造。Itô (1944) 发展随机积分 dX = μdt + σdW 与 Itô 公式,成为金融数学 (Black-Scholes 1973) 与随机微分方程的理论基石。
|
|
116
|
-
|
|
117
|
-
## Shannon 信息论 / Shannon Information Theory (1948)
|
|
118
|
-
|
|
119
|
-
> H(X) = -Σ p(x) log p(x) —— 熵,随机变量的不确定性度量
|
|
120
|
-
> I(X;Y) = H(X) - H(X|Y) —— 互信息,Y 对 X 提供的信息量
|
|
121
|
-
> C = max I(X;Y) —— 信道容量,可靠通信的速率上限
|
|
122
|
-
|
|
123
|
-
**含义**:信息可以被量化;通信的根本限制由数学定律决定,而非工程技术。
|
|
124
|
-
|
|
125
|
-
**数学背景**:Claude Shannon 在《A Mathematical Theory of Communication》(1948) 中创立信息论。信源编码定理:平均编码长度 ≥ H(X);信道编码定理:传输速率 R < C 时存在可靠编码。熵与概率的深层联系——H(X) = -E[log p(X)]——使信息论成为概率论的自然延伸。
|
|
126
|
-
|
|
127
|
-
## Pearl 因果推断 / Pearl's Causal Inference (2000)
|
|
128
|
-
|
|
129
|
-
> 因果层级:
|
|
130
|
-
> 1. 关联 P(y|x) —— 看到
|
|
131
|
-
> 2. 干预 P(y|do(x)) —— 做
|
|
132
|
-
> 3. 反事实 P(yₓ|x', y') —— 想
|
|
133
|
-
|
|
134
|
-
**含义**:因果不是关联的强化版——"do(x)" 与 "observe x" 在数学上截然不同。
|
|
135
|
-
|
|
136
|
-
**数学背景**:Judea Pearl 在《Causality》(2000) 中用有向无环图 (DAG) 与 do-演算系统化了因果推断。do-演算三条规则允许在可观测变量间转换干预概率;前门/后门准则给出从观测数据计算因果效应的条件。因果推断回答"若我做了 x,y 会怎样",这超出了概率论本身的表达能力。
|
|
137
|
-
|
|
138
|
-
## Bootstrap 方法 / Bootstrap (Efron, 1979)
|
|
139
|
-
|
|
140
|
-
> 从样本 X₁,...,Xₙ 中有放回抽样 B 次,得到 B 个 bootstrap 样本,
|
|
141
|
-
> 用 bootstrap 分布近似真实分布。
|
|
142
|
-
|
|
143
|
-
**含义**:当理论推导困难时,用数据自身模拟抽样过程——"用自己验证自己"。
|
|
144
|
-
|
|
145
|
-
**数学背景**:Bradley Efron (1979) 提出 bootstrap,其理论保证由 Bickel-Freedman (1981) 与 Singh (1981) 建立:在温和条件下,bootstrap 分布一致收敛于真实抽样分布。Bootstrap 可估计标准误、置信区间(百分位法/BCa 法)、p-value 等,是非参数推断的通用工具。
|
|
146
|
-
|
|
147
|
-
## 贝叶斯学派 vs 频率学派 / Bayesian vs Frequentist Debate
|
|
148
|
-
|
|
149
|
-
> 贝叶斯:概率是信念度,参数 θ 是随机变量 → P(θ|data)
|
|
150
|
-
> 频率学派:概率是长期频率,参数 θ 是固定未知常 → 估计量 θ̂ 的抽样分布
|
|
151
|
-
|
|
152
|
-
**含义**:这不是技术分歧,而是"概率是什么"的哲学分歧。
|
|
153
|
-
|
|
154
|
-
**核心对比**:
|
|
155
|
-
- 贝叶斯:先验 + 似然 → 后验,天然适合序贯更新与小样本
|
|
156
|
-
- 频率学派:无偏性、一致性、功效,天然适合大规模可重复实验
|
|
157
|
-
- 实践中:贝叶斯方法在机器学习、因果推断中占优;频率方法在临床试验、质量控制中占优
|
|
158
|
-
|
|
159
|
-
**数学背景**:争论自 Laplace vs Fisher 延续至今。Jeffreys (1939) 提出无信息先验 p(θ) ∝ |I(θ)|^(1/2);de Finetti (1937) 证明主观概率的一致性等价于可加性;Bernardo-Smith (1994) 发展参考先验理论。
|
|
160
|
-
|
|
161
|
-
## Monty Hall 问题 / Monty Hall Problem
|
|
162
|
-
|
|
163
|
-
> 三扇门,一扇有奖品。你选一扇,主持人打开另一扇空门。
|
|
164
|
-
> 问:你是否应该换门?答案是:换门胜率 2/3,不换 1/3。
|
|
165
|
-
|
|
166
|
-
**含义**:直觉在此失效——主持人的行为传递了信息(他不会打开有奖品的门)。
|
|
167
|
-
|
|
168
|
-
**数学背景**:此问题是贝叶斯思维的绝佳入门案例。用贝叶斯定理:P(奖品在剩余门|主持人打开空门) = 2/3,因为主持人选择性地避开奖品,这本身是信息。类似的结构出现在医疗诊断、法律推理中——"选择性观察"改变了概率。
|
|
169
|
-
|
|
170
|
-
## 常见统计谬误与认知偏差
|
|
171
|
-
|
|
172
|
-
**幸存者偏差(Survivorship Bias)**:
|
|
173
|
-
二战期间,军方统计返航飞机的弹孔分布,发现机翼上弹孔最多,建议加固机翼。统计学家 Abraham Wald 指出:应该加固没有弹孔的部位——因为被击中那些部位的飞机根本没飞回来。Wald 的洞察本质上是条件概率:我们观察到的数据是在"飞机返航"条件下的数据,而非全部数据。
|
|
174
|
-
|
|
175
|
-
**基础率忽视(Base Rate Neglect)**:
|
|
176
|
-
某种罕见病发病率 0.1%,检测准确率 99%。如果检测为阳性,真正患病的概率是多少?
|
|
177
|
-
- 直觉回答:99%
|
|
178
|
-
- 贝叶斯计算:P(患病|阳性) = 0.99 × 0.001 / (0.99 × 0.001 + 0.01 × 0.999) ≈ 9%
|
|
179
|
-
- 先验概率(基础率)被直觉严重低估
|
|
180
|
-
|
|
181
|
-
**回归均值(Regression to the Mean)**:
|
|
182
|
-
表现极好的个体在下次测量中倾向于更接近平均水平,不是因为"能力下降",而是极端表现部分来自运气。Galton (1886) 发现高个子父母的子女往往比父母矮——这不是"退化",而是统计规律。
|
|
183
|
-
|
|
184
|
-
## 概率思维的日常生活价值
|
|
185
|
-
|
|
186
|
-
> "概率思维的核心不是计算精确概率,而是养成'在不确定性中思考'的习惯。"
|
|
187
|
-
|
|
188
|
-
- 不要被单个案例说服——考虑基础概率
|
|
189
|
-
- 新信息来了要更新信念——贝叶斯更新
|
|
190
|
-
- 区分信号和噪声——大数定律
|
|
191
|
-
- 警惕极端值——回归均值
|
|
192
|
-
- 区分"看到"与"做了"——因果层级(Pearl)
|
|
193
|
-
- 量化不确定性——熵与信息(Shannon)
|