最大似然法求解Softmax回归

2019-03-28  本文已影响0人  deBroglie

概念

Softmax回归就是k分类的逻辑回归。

建模

1)假设目标变量\small{y}服从\small{k}项式分布\small{(\phi_1, \cdots, \phi_{k-1})}\small {\begin{eqnarray} p(y; \phi_1, \cdots, \phi_{k-1}) = \phi_{0}^{ \mathbf{1} \{ y = 0 \} } \phi_{1}^{ \mathbf{1} \{ y = 1 \} } \cdots \phi_{k-1}^{ \mathbf{1} \{ y=k-1 \} } \\ = (1 - \sum_{j=1}^{k-1} \phi_{j})^{1 - \sum_{j=1}^{k-1} \mathbf{1} \{ y = j \} } \phi_{1}^{ \mathbf{1} \{ y = 1 \} } \cdots \phi_{k-1}^{ \mathbf{1} \{ y = k-1 \} } \end{eqnarray} } 这里我们也用到了和最大似然求解k分类GDA模型中相同的指示函数\small{ \mathbf{1} \{ \cdot \}}
2)将以上\small{k}项式分布写为指数族分布形式。定义\small{T(y) \in \mathbb{R}^{k-1}}满足\small{[T(y)]_{i} = \mathbf{1} \{ y = i \} , i=1,\cdots,k-1},同时定义\small{T(0) = (0,\cdots,0)^{T} \in \mathbb{R}^{k-1} }\small{ \begin{eqnarray} &p(y; \phi_1, \cdots, \phi_{k-1}) = \phi_{0}^{ \mathbf{1} \{ y = 0 \} } \phi_{1}^{ \mathbf{1} \{ y = 1 \} } \cdots \phi_{k-1}^{ \mathbf{1} \{ y=k-1 \} } \\ =& (1 - \sum_{j=1}^{k-1} \phi_{j})^{1 - \sum_{j=1}^{k-1} \mathbf{1} \{ y = j \} } \phi_{1}^{ \mathbf{1} \{ y = 1 \} } \cdots \phi_{k-1}^{ \mathbf{1} \{ y = k-1 \} } \\ =& \end{eqnarray} } 根据广义线性模型\small{h(\vec{x})=E(y|\vec{x})}

未完待续

上一篇 下一篇

猜你喜欢

热点阅读