Skip to content

Commit 9159c61

Browse files
authored
Update backpropagation.qmd
1 parent 560d9c7 commit 9159c61

1 file changed

Lines changed: 16 additions & 25 deletions

File tree

backpropagation.qmd

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,27 @@ $\frac{\partial J}{\partial \theta_1}$,
7979
$\frac{\partial J}{\partial \theta_2}$, etc. Each of these gradients can
8080
be calculated via the chain rule. Here is the chain rule written out for
8181
the gradients for $\theta_1$ and $\theta_2$:
82-
8382
\[
83+
\newcommand{\sharedterm}{%
84+
\colorbox{shared_term_color}{%
85+
$\displaystyle
86+
\frac{\partial J}{\partial \mathbf{x}_L}
87+
\frac{\partial \mathbf{x}_L}{\partial \mathbf{x}_{L-1}}
88+
\cdots
89+
\frac{\partial \mathbf{x}_3}{\partial \mathbf{x}_2}
90+
$%
91+
}%
92+
}
8493
\begin{aligned}
85-
\frac{\partial J}{\partial \theta_1} &=
86-
\mathchoice%
87-
{\colorbox{shared_term_color}{\ensuremath{\displaystyle
88-
\frac{\partial J}{\partial \mathbf{x}_L}
89-
\frac{\partial \mathbf{x}_L}{\partial \mathbf{x}_{L-1}}
90-
\cdots
91-
\frac{\partial \mathbf{x}_3}{\partial \mathbf{x}_2}}}}%
92-
{\colorbox{shared_term_color}{\ensuremath{\textstyle
93-
\frac{\partial J}{\partial \mathbf{x}_L}
94-
\frac{\partial \mathbf{x}_L}{\partial \mathbf{x}_{L-1}}
95-
\cdots
96-
\frac{\partial \mathbf{x}_3}{\partial \mathbf{x}_2}}}}%
94+
\frac{\partial J}{\partial \theta_1}
95+
&=
96+
\sharedterm\,
9797
\frac{\partial \mathbf{x}_2}{\partial \mathbf{x}_1}
9898
\frac{\partial \mathbf{x}_1}{\partial \theta_1}
9999
\\
100-
\frac{\partial J}{\partial \theta_2} &=
101-
\mathchoice%
102-
{\colorbox{shared_term_color}{\ensuremath{\displaystyle
103-
\frac{\partial J}{\partial \mathbf{x}_L}
104-
\frac{\partial \mathbf{x}_L}{\partial \mathbf{x}_{L-1}}
105-
\cdots
106-
\frac{\partial \mathbf{x}_3}{\partial \mathbf{x}_2}}}}%
107-
{\colorbox{shared_term_color}{\ensuremath{\textstyle
108-
\frac{\partial J}{\partial \mathbf{x}_L}
109-
\frac{\partial \mathbf{x}_L}{\partial \mathbf{x}_{L-1}}
110-
\cdots
111-
\frac{\partial \mathbf{x}_3}{\partial \mathbf{x}_2}}}}%
100+
\frac{\partial J}{\partial \theta_2}
101+
&=
102+
\sharedterm\,
112103
\frac{\partial \mathbf{x}_2}{\partial \theta_2}
113104
\end{aligned}
114105
\]

0 commit comments

Comments
 (0)