Help us understand the problem. What is going on with this article?

行列の微分(2)

More than 1 year has passed since last update.

(概要)
『ゼロから作るDeep Learning』読書会@高円寺(15)に参加してきた。
https://koenjidl.connpass.com/event/69408/
この書籍で、下記(1)式他の導出が省略されていた。
行列の微分を、スカラ値の微分の感覚で行うと
あいまいな点がのこるので、要素に分解して導出した。

(方針)
行列の微分を、要素に分解して、多変数のスカラ関数の
スカラ値による微分に、置き換えて解く。
導出した式は、少し変形すれば、一般性を失わないので
公式として利用できる。

(求める式)

(1)
\begin{equation*}
\frac{\partial L}{\partial W} =X^{T} ・\frac{\partial L}{\partial Y}
\end{equation*}

(変数)

\begin{gather*}
(2)Y=( y_{1} ,y_{2} ,y_{3})\\
(3)X=( x_{1} ,x_{2})\\
(4)W=\begin{pmatrix}
w_{11} & w_{21} & w_{31}\\
w_{12} & w_{22} & w_{32}
\end{pmatrix}
\end{gather*}

(前準備)

(5)
\begin{equation*}
XW=\left( x_{1} w_{11} +x_{2} w_{12} ,\ x_{1} w_{21} +x_{2} w_{22} ,\ x_{1} w_{31} +x_{2} w_{32}\right)
\end{equation*}
(6)
\begin{equation*}
y_{k} =\sum _{m} x_{m} ・w_{km} +b_{k}
\end{equation*}

(式展開)

\begin{gather*}
\frac{\partial L}{\partial w_{11}} =\sum _{i}\frac{\partial L}{\partial y_{i}} ・\frac{\partial y_{i}}{\partial w_{11}}\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\frac{\partial L}{\partial y_{1}} ・x_{1} +\frac{\partial L}{\partial y_{2}} ・0+\frac{\partial L}{\partial y_{3}} ・0\\
=\frac{\partial L}{\partial y_{1}} ・x_{1}\\
\frac{\partial L}{\partial w_{ij}} =\sum _{k}\frac{\partial L}{\partial y_{k}} ・\frac{\partial y_{k}}{\partial w_{ij}}\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\sum _{k}\frac{\partial L}{\partial y_{k}} ・\left(\frac{\partial }{\partial w_{ij}}\left(\sum _{m} x_{m} ・w_{km} +b_{k}\right)\right)\\
=\frac{\partial L}{\partial y_{i}} ・x_{j}\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \frac{\partial L}{\partial W} =\begin{pmatrix}
\frac{\partial L}{\partial y_{1}} ・x_{1} & \frac{\partial L}{\partial y_{2}} ・x_{1} & \frac{\partial L}{\partial y_{3}} ・x_{1}\\
\frac{\partial L}{\partial y_{1}} ・x_{2} & \frac{\partial L}{\partial y_{2}} ・x_{2} & \frac{\partial L}{\partial y_{3}} ・x_{2}
\end{pmatrix}\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\begin{pmatrix}
x_{1}\\
x_{2}
\end{pmatrix} ・\begin{pmatrix}
\frac{\partial L}{\partial y_{1}} & \frac{\partial L}{\partial y_{2}} & \frac{\partial L}{\partial y_{3}}
\end{pmatrix}\\
\ =X^{T} ・\frac{\partial L}{\partial Y}
\end{gather*}
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした