熵、交叉熵、KL 散度
用一组具体数字,把这三个概念一次讲透 1. 固定场景 有两个分布: Teacher 分布 (P):老师认为的真实概率 Student 分布 (Q):学生学出来的概率 假设有 3 个类别:A / B / C 类别 Teacher P Student Q A 0.7 0.6 B 0.2 0.3 C 0.1 0.1 数组表示: P = [0.7, 0.2, 0.1] Q = [0.6, 0.3, 0.1] 2. 熵 (Entropy) 定义 $$H(P) = -\sum_i P_i \log P_i$$ 计算 已知: $\log 0.7 \approx -0.357$ $\log 0.2 \approx -1.609$ $\log 0.1 \approx -2.303$ 代入: $$ \begin{aligned} H(P) &= -(0.7 \times -0.357 + 0.2 \times -1.609 + 0.1 \times -2.303) \ &= 0.250 + 0.322 + 0.230 \ &\approx 0.802 \end{aligned} $$ ...