矩阵、向量求导法则

From:矩阵、向量求导法则

复杂矩阵问题求导方法:可以从小到大,从scalar到vector再到matrix。

\( \)

\begin{equation}
J(U,V)=\Arrowvert{}UV^T-Y\Arrowvert{}^2_{Fro}+\frac{\lambda}{2}(||U||^2_{Fro}+||V||^2_{Fro})\\
=\sum_{i,j} \lgroup \sum_{a} U_{ia}V_{ja}-Y_{ij}\rgroup^2+\frac{\lambda}{2}\lgroup \sum_{i,a}U^2_{ia}+\sum_{j,a}V^2_{ja} \rgroup
\end{equation}

 

$$
\frac{\partial{J}}{\partial{U_{ia}}}=\dots\dots
=2\sum_{j}(U_iV_j^T-Y_{ij})V_{ja}+\lambda{}U_{ia}\\
=2(U_iV^T-Y_{i})V_{\cdot{}a}+\lambda{}U_{ia}\\
\frac{\partial{J}}{\partial{U_{i}}}=2(U_iV^T-Y_{i})V+\lambda{}U_{i}\\
\frac{\partial{J}}{\partial{U}}=2(UV^T-Y)V+\lambda{}U
$$

x is a column vector, A is a matrix

$$d(A*x)/dx=A$$

$$d(x^T*A)/dx^T=A$$

$$d(x^T*A)/dx=A^T$$

$$d(x^T*A*x)/dx=x^T(A^T+A)$$

practice:
$$\frac{\partial{a^TXb}}{\partial{X}}=ab^T$$
$$\frac{\partial{a^TX^Tb}}{\partial{X}}=ba^T$$

发表评论

邮箱地址不会被公开。 必填项已用*标注