CS229 笔记02
Posted GENKUN
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CS229 笔记02相关的知识,希望对你有一定的参考价值。
CS229 笔记02
公式推导
$ {\rm Let}, A, B, C \in {\rm {R}}^{n \times n}. $
$ \text{Fact.1: If}, a \in {\rm R},, {\rm tr},a=a $
显然。
$\text{Fact.2:}, {\rm{tr}}A={\rm{tr}}A^T $
\[
\begin{eqnarray*} {\rm {tr}}\,A&=&\prod_{i=1}^n{a_{ii}} \\
&=&{\rm {tr}}\,A^T
\end{eqnarray*}
\]
$\text{Fact.3:},{\rm{tr}},AB={\rm{tr}},BA $
\[
\begin{eqnarray*}
{\rm tr}\,AB&=&\prod_{i=1}^n{[AB]_{ii}} \&=&\sum_{k=1}^{n}{a_{ik}\,b_{ki}} \&=&\sum_{k=1}^{n}{b_{ik}\,a_{ki}} \&=&\prod_{i=1}^n{[BA]_{ii}} \&=&{\rm tr}\,BA \\end{eqnarray*}
\]
$ \text{Fact.4:},{\rm{tr}},ABC={\rm{tr}},CAB={\rm{tr}},BCA $
\[
\begin{eqnarray*}
{\rm tr}\,ABC&=&{\rm tr}\,(AB)C \&=&{\rm tr}\,C(AB) \tag{Fact.3} \&=&{\rm tr}\,A(BC) \&=&{\rm tr}\,(BC)A \tag{Fact.3} \\end{eqnarray*}
\]
\(\text{Fact.4:}\, \nabla_A\,{\rm {tr}\, AB}=B^T\)
\[
{\rm {tr}\, AB}=\prod_{i=1}^n{[AB]_{ii}}=\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}
\]
\[ \begin{eqnarray*} \nabla_A\,{\rm {tr}\, AB}&=&\frac{\partial{\rm {tr}\,AB}}{\partial A} \&=&\begin{bmatrix}\frac{\partial\,{\rm {tr}\,AB}}{\partial a_{11}} & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{12}} & \cdots & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{1n}} \\ \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{21}} & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{22}} & \cdots & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{2n}} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{n1}} & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{n2}} & \cdots & \frac{\partial\,{\rm {tr}\,AB}}{\partial a_{nn}}\end{bmatrix} \&=&\begin{bmatrix}\frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{11}} & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{12}} & \cdots & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{1n}} \\ \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{21}} & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{22}} & \cdots & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{2n}} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{n1}} & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{n2}} & \cdots & \frac{\partial\,\prod_{i=1}^n{\sum_{k=1}^n{a_{ik}\,b_{ki}}}}{\partial a_{nn}}\end{bmatrix} \\end{eqnarray*} \]
以上是关于CS229 笔记02的主要内容,如果未能解决你的问题,请参考以下文章