基础参数模型与学习的统计视角
1. 多类逻辑回归与交叉熵成本
多类逻辑回归(使用softmax)会为任意的输入 $x$ 和参数 $\theta$ 返回一个三维的概率向量 $g(x; \theta)$。若将所有向量 $g(x_i; \theta)$($i = 1, \cdots, 6$)转置后的对数堆叠起来,可得到矩阵 $G$:
$G =
\begin{bmatrix}
\ln g_1(x_1; \theta) \
\ln g_2(x_1; \theta) \
\ln g_3(x_1; \theta) \
\ln g_1(x_2; \theta) \
\ln g_2(x_2; \theta) \
\ln g_3(x_2; \theta) \
\ln g_1(x_3; \theta) \
\ln g_2(x_3; \theta) \
\ln g_3(x_3; \theta) \
\ln g_1(x_4; \theta) \
\ln g_2(x_4; \theta) \
\ln g_3(x_4; \theta) \
\ln g_1(x_5; \theta) \
\ln g_2(x_5; \theta) \
\ln g_3(x_5; \theta) \
\ln g_1(x_6; \theta) \
\ln g_2(x_6; \theta) \
\ln g_3(x_6; \theta)
\end{bmatrix}$
计算多类交叉熵成本(3.44)只需取所有圈出元素的平均值,再乘以 $-1$。第
超级会员免费看
订阅专栏 解锁全文
1803

被折叠的 条评论
为什么被折叠?



