Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
单韦乔
Toy-MT-Introduction
Commits
be087cd2
Commit
be087cd2
authored
Feb 24, 2020
by
liuhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update slides5
parent
c0fe49af
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
22 行删除
+22
-22
Section05-Neural-Networks-and-Language-Modeling/section05.tex
+22
-22
没有找到文件。
Section05-Neural-Networks-and-Language-Modeling/section05.tex
查看文件 @
be087cd2
...
@@ -2817,9 +2817,9 @@ cycle}
...
@@ -2817,9 +2817,9 @@ cycle}
\end{enumerate}
\end{enumerate}
\item
<2->
\textbf
{
定义目标
}
:对于给定
$
\textbf
{
x
}$
,什么样的
$
\textbf
{
y
}$
是好的
\item
<2->
\textbf
{
定义目标
}
:对于给定
$
\textbf
{
x
}$
,什么样的
$
\textbf
{
y
}$
是好的
\begin{itemize}
\begin{itemize}
\item
假设:多个输入样本
$
\{\textbf
{
x
}_
1
,...,
\textbf
{
x
}_
n
\}
$
,每个
$
\textbf
{
x
}_
i
$
都对应
\alert
{
正确答案
}$
\
hat
{
\textbf
{
y
}}_
i
$
\item
假设:多个输入样本
$
\{\textbf
{
x
}_
1
,...,
\textbf
{
x
}_
n
\}
$
,每个
$
\textbf
{
x
}_
i
$
都对应
\alert
{
正确答案
}$
\
tilde
{
\textbf
{
y
}}_
i
$
\item
对于一个神经网络
$
\textbf
{
y
}
=
f
(
\textbf
{
x
}
)
$
,每个
$
\textbf
{
x
}_
i
$
也会有一个输出
$
\textbf
{
y
}_
i
$
\item
对于一个神经网络
$
\textbf
{
y
}
=
f
(
\textbf
{
x
}
)
$
,每个
$
\textbf
{
x
}_
i
$
也会有一个输出
$
\textbf
{
y
}_
i
$
\item
如果可以度量答案
$
\
hat
{
\textbf
{
y
}}_
i
$
和网络输出
$
\textbf
{
y
}_
i
$
之间的偏差,进而调整网络参数减小这种偏差,就可以得到更好的模型
\item
如果可以度量答案
$
\
tilde
{
\textbf
{
y
}}_
i
$
和网络输出
$
\textbf
{
y
}_
i
$
之间的偏差,进而调整网络参数减小这种偏差,就可以得到更好的模型
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}
...
@@ -2835,12 +2835,12 @@ cycle}
...
@@ -2835,12 +2835,12 @@ cycle}
\draw
[->,thick]
(-6,0) -- (5,0);
\draw
[->,thick]
(-6,0) -- (5,0);
\draw
[->,thick]
(-5,-4) -- (-5,5);
\draw
[->,thick]
(-5,-4) -- (-5,5);
\draw
[<-] (-2.5,4) -- (-2,5) node [pos=1,right,inner sep=2pt]
{
\footnotesize
{
答案
$
\
hat
{
\textbf
{
y
}}_
i
$}}
;
\draw
[<-] (-2.5,4) -- (-2,5) node [pos=1,right,inner sep=2pt]
{
\footnotesize
{
答案
$
\
tilde
{
\textbf
{
y
}}_
i
$}}
;
\visible
<4->
{
\visible
<4->
{
\draw
[<-] (-3,-3) -- (-2.5,-2) node [pos=0,left,inner sep=2pt]
{
\footnotesize
{
预测
$
\textbf
{
y
}_
i
$}}
;
}
\draw
[<-] (-3,-3) -- (-2.5,-2) node [pos=0,left,inner sep=2pt]
{
\footnotesize
{
预测
$
\textbf
{
y
}_
i
$}}
;
}
\visible
<5->
{
\visible
<5->
{
\draw
[<-] (2.3,1) -- (3.3,2) node [pos=1,right,inner sep=2pt]
{
\footnotesize
{
偏差
$
|
\
hat
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i|
$}}
;
\draw
[<-] (2.3,1) -- (3.3,2) node [pos=1,right,inner sep=2pt]
{
\footnotesize
{
偏差
$
|
\
tilde
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i|
$}}
;
\foreach
\x
in
{
-3.8,-3.7,...,3.0
}{
\foreach
\x
in
{
-3.8,-3.7,...,3.0
}{
\pgfmathsetmacro
{
\p
}{
- 1/14 * (
\x
+ 4) * (
\x
+ 1) * (
\x
- 1) * (
\x
- 3)
}
;
\pgfmathsetmacro
{
\p
}{
- 1/14 * (
\x
+ 4) * (
\x
+ 1) * (
\x
- 1) * (
\x
- 3)
}
;
\pgfmathsetmacro
{
\q
}{
- 1/14 * (4*
\x*\x*\x
+ 3*
\x*\x
- 26*
\x
- 1)
}
;
\pgfmathsetmacro
{
\q
}{
- 1/14 * (4*
\x*\x*\x
+ 3*
\x*\x
- 26*
\x
- 1)
}
;
...
@@ -2855,7 +2855,7 @@ cycle}
...
@@ -2855,7 +2855,7 @@ cycle}
\vspace
{
-0.3em
}
\vspace
{
-0.3em
}
\begin{itemize}
\begin{itemize}
\item
<6-> 这个过程就是
\alert
{
参数优化/训练
}
,而
$
\
hat
{
\textbf
{
y
}}_
i
$
和
$
\textbf
{
y
}_
i
$
之间偏差的度量就是一种
\alert
{
损失函数
}
,也称作训练的
\alert
{
目标函数
}
,而优化的目标就是
\textbf
{
最小化损失函数
}
\item
<6-> 这个过程就是
\alert
{
参数优化/训练
}
,而
$
\
tilde
{
\textbf
{
y
}}_
i
$
和
$
\textbf
{
y
}_
i
$
之间偏差的度量就是一种
\alert
{
损失函数
}
,也称作训练的
\alert
{
目标函数
}
,而优化的目标就是
\textbf
{
最小化损失函数
}
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
...
@@ -2865,7 +2865,7 @@ cycle}
...
@@ -2865,7 +2865,7 @@ cycle}
\begin{frame}
{
常见的损失函数
}
\begin{frame}
{
常见的损失函数
}
\begin{itemize}
\begin{itemize}
\item
损失函数记为
$
Loss
(
\
hat
{
\textbf
{
y
}}_
i,
\textbf
{
y
}_
i
)
$
,简记为
$
L
$
,以下是常用的定义
\item
损失函数记为
$
Loss
(
\
tilde
{
\textbf
{
y
}}_
i,
\textbf
{
y
}_
i
)
$
,简记为
$
L
$
,以下是常用的定义
\end{itemize}
\end{itemize}
\vspace
{
0.5em
}
\vspace
{
0.5em
}
...
@@ -2873,14 +2873,14 @@ cycle}
...
@@ -2873,14 +2873,14 @@ cycle}
\footnotesize
{
\footnotesize
{
\renewcommand
{
\arraystretch
}{
1.2
}
\renewcommand
{
\arraystretch
}{
1.2
}
\begin{tabular}
{
l | l | l | l
}
\begin{tabular}
{
l | l | l | l
}
名称
&
定义
&
NiuTensor实现(
\texttt
{
yh
}
表示
$
\
hat
{
\textbf
{
y
}}_
i
$
)
&
应用
\\
\hline
名称
&
定义
&
NiuTensor实现(
\texttt
{
yh
}
表示
$
\
tilde
{
\textbf
{
y
}}_
i
$
)
&
应用
\\
\hline
0-1
&
$
L
=
\left\{
\begin
{
array
}{
ll
}
0
&
\
hat
{
\textbf
{
y
}}_
i
=
\textbf
{
y
}_
i
\\
1
&
\hat
{
\textbf
{
y
}}_
i
\ne
\textbf
{
y
}_
i
\end
{
array
}
\right
.
$
&
\scriptsize
{
\texttt
{
L = Sign(Absolute(yh - y))
}}
&
感知机
\\
0-1
&
$
L
=
\left\{
\begin
{
array
}{
ll
}
0
&
\
tilde
{
\textbf
{
y
}}_
i
=
\textbf
{
y
}_
i
\\
1
&
\tilde
{
\textbf
{
y
}}_
i
\ne
\textbf
{
y
}_
i
\end
{
array
}
\right
.
$
&
\scriptsize
{
\texttt
{
L = Sign(Absolute(yh - y))
}}
&
感知机
\\
Hinge
&
$
L
=
\max
(
0
,
1
-
\
hat
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Max(0, 1 - yh * y))
}}
&
SVM
\\
Hinge
&
$
L
=
\max
(
0
,
1
-
\
tilde
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Max(0, 1 - yh * y))
}}
&
SVM
\\
绝对值
&
$
L
=
|
\
hat
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i|
$
&
\scriptsize
{
\texttt
{
L = Absolute(yh - y)
}}
&
回归
\\
绝对值
&
$
L
=
|
\
tilde
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i|
$
&
\scriptsize
{
\texttt
{
L = Absolute(yh - y)
}}
&
回归
\\
Logistic
&
$
L
=
\log
(
1
+
\
hat
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Log(1 + yh * y)
}}
&
回归
\\
Logistic
&
$
L
=
\log
(
1
+
\
tilde
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Log(1 + yh * y)
}}
&
回归
\\
平方
&
$
L
=(
\
hat
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i
)
^
2
$
&
\scriptsize
{
\texttt
{
L = Power(yh - y, 2)
}}
&
回归
\\
平方
&
$
L
=(
\
tilde
{
\textbf
{
y
}}_
i
-
\textbf
{
y
}_
i
)
^
2
$
&
\scriptsize
{
\texttt
{
L = Power(yh - y, 2)
}}
&
回归
\\
指数
&
$
L
=
\exp
(-
\
hat
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Exp(Negate(yh * y))
}}
&
\scriptsize
{
AdaBoost
}
\\
指数
&
$
L
=
\exp
(-
\
tilde
{
\textbf
{
y
}}_
i
\cdot
\textbf
{
y
}_
i
)
$
&
\scriptsize
{
\texttt
{
L = Exp(Negate(yh * y))
}}
&
\scriptsize
{
AdaBoost
}
\\
交叉熵
&
$
L
=-
\sum
_
k
\textbf
{
y
}_
i
^{
[
k
]
}
\log
\
hat
{
\textbf
{
y
}}_
i
^{
[
k
]
}
$
&
\scriptsize
{
\texttt
{
L = CrossEntropy(y, yh)
}}
&
多分类
\\
交叉熵
&
$
L
=-
\sum
_
k
\textbf
{
y
}_
i
^{
[
k
]
}
\log
\
tilde
{
\textbf
{
y
}}_
i
^{
[
k
]
}
$
&
\scriptsize
{
\texttt
{
L = CrossEntropy(y, yh)
}}
&
多分类
\\
&
\scriptsize
{$
\textbf
{
y
}_
i
^{
[
k
]
}$
:
$
\textbf
{
y
}_
i
$
的第
$
k
$
维
}
&
&
\\
&
\scriptsize
{$
\textbf
{
y
}_
i
^{
[
k
]
}$
:
$
\textbf
{
y
}_
i
$
的第
$
k
$
维
}
&
&
\\
\end{tabular}
\end{tabular}
\renewcommand
{
\arraystretch
}{
1.0
}
\renewcommand
{
\arraystretch
}{
1.0
}
...
@@ -2891,7 +2891,7 @@ Logistic & $L=\log(1 + \hat{\textbf{y}}_i \cdot \textbf{y}_i)$ & \scriptsize{\te
...
@@ -2891,7 +2891,7 @@ Logistic & $L=\log(1 + \hat{\textbf{y}}_i \cdot \textbf{y}_i)$ & \scriptsize{\te
\item
注意:
\item
注意:
\begin{itemize}
\begin{itemize}
\item
损失函数可以根据问题不同进行选择,没有固定要求
\item
损失函数可以根据问题不同进行选择,没有固定要求
\item
有些损失函数对网络输出有约束,比如交叉熵要求
$
\
hat
{
\textbf
{
y
}}_
i
$
和
$
\textbf
{
y
}_
i
$
都是概率分布
\item
有些损失函数对网络输出有约束,比如交叉熵要求
$
\
tilde
{
\textbf
{
y
}}_
i
$
和
$
\textbf
{
y
}_
i
$
都是概率分布
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}
...
@@ -2902,13 +2902,13 @@ Logistic & $L=\log(1 + \hat{\textbf{y}}_i \cdot \textbf{y}_i)$ & \scriptsize{\te
...
@@ -2902,13 +2902,13 @@ Logistic & $L=\log(1 + \hat{\textbf{y}}_i \cdot \textbf{y}_i)$ & \scriptsize{\te
\begin{frame}
{
参数优化
}
\begin{frame}
{
参数优化
}
\begin{itemize}
\begin{itemize}
\item
对于第
$
i
$
个输入样本(
$
\textbf
{
x
}_
i
$
,
$
\
hat
{
\textbf
{
y
}}_
i
$
),如果把损失函数看做参数
$
\textbf
{
w
}$
的函数(把
$
\textbf
{
b
}$
也作为一种
$
\textbf
{
w
}$
),记为
$
L
(
\textbf
{
x
}_
i,
\hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
$
,则参数学习可以被描述为:
\\
\item
对于第
$
i
$
个输入样本(
$
\textbf
{
x
}_
i
$
,
$
\
tilde
{
\textbf
{
y
}}_
i
$
),如果把损失函数看做参数
$
\textbf
{
w
}$
的函数(把
$
\textbf
{
b
}$
也作为一种
$
\textbf
{
w
}$
),记为
$
L
(
\textbf
{
x
}_
i,
\tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
$
,则参数学习可以被描述为:
\\
\begin{displaymath}
\begin{displaymath}
\
textbf
{
w
}^
* =
\argmin
_{
\textbf
{
w
}}
\frac
{
1
}{
n
}
\sum
_{
i=1
}^{
n
}
L(
\textbf
{
x
}_
i,
\hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
\
hat
{
\textbf
{
w
}}
=
\argmin
_{
\textbf
{
w
}}
\frac
{
1
}{
n
}
\sum
_{
i=1
}^{
n
}
L(
\textbf
{
x
}_
i,
\tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
\end{displaymath}
\end{displaymath}
$
\
textbf
{
w
}^
*
$
表示在训练集上使得损失的平均值达到最小的参数。
$
\frac
{
1
}{
n
}
\sum
_{
i
=
1
}^{
n
}
L
(
\textbf
{
x
}_
i,
\hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
$
被称作代价函数(cost function),它是损失函数均值期望的估计。
$
\
hat
{
\textbf
{
w
}}$
表示在训练集上使得损失的平均值达到最小的参数。
$
\frac
{
1
}{
n
}
\sum
_{
i
=
1
}^{
n
}
L
(
\textbf
{
x
}_
i,
\tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}
)
$
被称作代价函数(cost function),它是损失函数均值期望的估计。
\vspace
{
0.5em
}
\vspace
{
0.5em
}
...
@@ -3012,7 +3012,7 @@ $\textbf{w}^*$表示在训练集上使得损失的平均值达到最小的参数
...
@@ -3012,7 +3012,7 @@ $\textbf{w}^*$表示在训练集上使得损失的平均值达到最小的参数
\item
<2->
\textbf
{
批量梯度下降(Batch Gradient Descent)
}
:
\item
<2->
\textbf
{
批量梯度下降(Batch Gradient Descent)
}
:
\begin{displaymath}
\begin{displaymath}
J(
\textbf
{
w
}_
t) =
\frac
{
1
}{
n
}
\sum
_{
i=1
}^{
n
}
L(
\textbf
{
x
}_
i,
\
hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
J(
\textbf
{
w
}_
t) =
\frac
{
1
}{
n
}
\sum
_{
i=1
}^{
n
}
L(
\textbf
{
x
}_
i,
\
tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
\end{displaymath}
\end{displaymath}
这种方法训练稳定,但是由于每次更新需要对所有训练样本进行遍历,效率低(比如
$
n
$
很大),大规模数据上很少使用
这种方法训练稳定,但是由于每次更新需要对所有训练样本进行遍历,效率低(比如
$
n
$
很大),大规模数据上很少使用
...
@@ -3029,7 +3029,7 @@ J(\textbf{w}_t) = \frac{1}{n} \sum_{i=1}^{n} L(\textbf{x}_i,\hat{\textbf{y}}_i;\
...
@@ -3029,7 +3029,7 @@ J(\textbf{w}_t) = \frac{1}{n} \sum_{i=1}^{n} L(\textbf{x}_i,\hat{\textbf{y}}_i;\
\item
\textbf
{
随机梯度下降(Stochastic Gradient Descent)
}
:
\item
\textbf
{
随机梯度下降(Stochastic Gradient Descent)
}
:
\begin{displaymath}
\begin{displaymath}
J(
\textbf
{
w
}_
t) = L(
\textbf
{
x
}_
i,
\
hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
J(
\textbf
{
w
}_
t) = L(
\textbf
{
x
}_
i,
\
tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
\end{displaymath}
\end{displaymath}
大名鼎鼎的SGD,所有机器学习的课程里几乎都有介绍。每次随机选取一个样本进行梯度计算和参数更新,更新的计算代价低,而且适用于利用少量样本进行在线学习(online learning),不过方法收敛慢
大名鼎鼎的SGD,所有机器学习的课程里几乎都有介绍。每次随机选取一个样本进行梯度计算和参数更新,更新的计算代价低,而且适用于利用少量样本进行在线学习(online learning),不过方法收敛慢
...
@@ -3040,7 +3040,7 @@ J(\textbf{w}_t) = L(\textbf{x}_i,\hat{\textbf{y}}_i;\textbf{w}_t)
...
@@ -3040,7 +3040,7 @@ J(\textbf{w}_t) = L(\textbf{x}_i,\hat{\textbf{y}}_i;\textbf{w}_t)
\item
<2->
\textbf
{
小批量梯度下降(Mini-batch Gradient Descent)
}
:
\item
<2->
\textbf
{
小批量梯度下降(Mini-batch Gradient Descent)
}
:
\begin{displaymath}
\begin{displaymath}
J(
\textbf
{
w
}_
t) =
\frac
{
1
}{
m
}
\sum
_{
i=j
}^{
j+m
}
L(
\textbf
{
x
}_
i,
\
hat
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
J(
\textbf
{
w
}_
t) =
\frac
{
1
}{
m
}
\sum
_{
i=j
}^{
j+m
}
L(
\textbf
{
x
}_
i,
\
tilde
{
\textbf
{
y
}}_
i;
\textbf
{
w
}_
t)
\end{displaymath}
\end{displaymath}
每次随机使用若干样本进行参数更新(数量不会特别大),算是一种折中方案,当今最常用的方法之一
每次随机使用若干样本进行参数更新(数量不会特别大),算是一种折中方案,当今最常用的方法之一
...
@@ -3469,7 +3469,7 @@ $+2x^2+x+1)$ & \ \ $(x^4+2x^3+2x^2+x+1)$ & $+6x+1$ \\
...
@@ -3469,7 +3469,7 @@ $+2x^2+x+1)$ & \ \ $(x^4+2x^3+2x^2+x+1)$ & $+6x+1$ \\
\end{center}
\end{center}
\begin{itemize}
\begin{itemize}
\item
<2->
\raisebox
{
-0.7em
}{
\tikz
{
\node
[anchor=west,fill=red!20] (factor01) at (factor00.east)
{$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}$}
;
}}
表示损失
$
L
$
相对网络输出的变化率,比如,对于
$
L
=
\frac
{
1
}{
2
}
||
\
hat
{
\textbf
{
y
}}
-
\textbf
{
h
}^
K||
^
2
$
,有
$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}
=
\hat
{
\textbf
{
y
}}
-
\textbf
{
h
}^
K
$
\item
<2->
\raisebox
{
-0.7em
}{
\tikz
{
\node
[anchor=west,fill=red!20] (factor01) at (factor00.east)
{$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}$}
;
}}
表示损失
$
L
$
相对网络输出的变化率,比如,对于
$
L
=
\frac
{
1
}{
2
}
||
\
tilde
{
\textbf
{
y
}}
-
\textbf
{
h
}^
K||
^
2
$
,有
$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}
=
\tilde
{
\textbf
{
y
}}
-
\textbf
{
h
}^
K
$
\item
<3->
\raisebox
{
-0.7em
}{
\tikz
{
\node
[anchor=west,fill=blue!20] (factor01) at (factor00.east)
{$
\frac
{
\partial
f
^
K
(
\textbf
{
s
}^
K
)
}{
\partial
\textbf
{
s
}^
K
}$}
;
}}
表示激活函数相对于它自己的输入的变化率,比如,对于
$
f
(
\textbf
{
s
}
)
=
\frac
{
1
}{
1
+
\exp
(-
\textbf
{
s
}
)
}$
,有
$
\frac
{
\partial
f
(
\textbf
{
s
}
)
}{
\partial
\textbf
{
s
}}
=
f
(
\textbf
{
s
}
)(
1
-
f
(
\textbf
{
s
}
))
$
\item
<3->
\raisebox
{
-0.7em
}{
\tikz
{
\node
[anchor=west,fill=blue!20] (factor01) at (factor00.east)
{$
\frac
{
\partial
f
^
K
(
\textbf
{
s
}^
K
)
}{
\partial
\textbf
{
s
}^
K
}$}
;
}}
表示激活函数相对于它自己的输入的变化率,比如,对于
$
f
(
\textbf
{
s
}
)
=
\frac
{
1
}{
1
+
\exp
(-
\textbf
{
s
}
)
}$
,有
$
\frac
{
\partial
f
(
\textbf
{
s
}
)
}{
\partial
\textbf
{
s
}}
=
f
(
\textbf
{
s
}
)(
1
-
f
(
\textbf
{
s
}
))
$
\item
<4-> 这个结果符合直觉,在
$
s
^
K
$
出的梯度相当于在损失函数微分(
$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}$
)和激活函数微分(
$
\frac
{
\partial
f
^
K
(
\textbf
{
s
}^
K
)
}{
\partial
\textbf
{
s
}^
K
}$
) 的乘积
\visible
<5->
{
,注意这里所有操作都是单元级,比如张量按单元乘法
}
\item
<4-> 这个结果符合直觉,在
$
s
^
K
$
出的梯度相当于在损失函数微分(
$
\frac
{
\partial
L
}{
\partial
\textbf
{
h
}^
K
}$
)和激活函数微分(
$
\frac
{
\partial
f
^
K
(
\textbf
{
s
}^
K
)
}{
\partial
\textbf
{
s
}^
K
}$
) 的乘积
\visible
<5->
{
,注意这里所有操作都是单元级,比如张量按单元乘法
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论