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
NiuTrans
Toy-MT-Introduction
Commits
87b27ca0
You need to sign in or sign up before continuing.
Commit
87b27ca0
authored
May 12, 2020
by
单韦乔
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'shanweiqiao' 到 'caorunzhe'
修改第四章,第七章textbf为matbf 查看合并请求
!143
parents
8fa9aebf
fe17fa55
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
61 行增加
和
61 行删除
+61
-61
Book/Chapter4/chapter4.tex
+55
-55
Book/Chapter7/Chapter7.tex
+6
-6
没有找到文件。
Book/Chapter4/chapter4.tex
查看文件 @
87b27ca0
...
...
@@ -24,7 +24,7 @@
\section
{
翻译中的结构信息
}
\parinterval
首先,回顾一下基于单词的统计翻译模型是如何完成翻译的。图
\ref
{
fig:4-1
}
展示了一个实例。其中,左侧是一个单词的``翻译表'',它记录了源语言(中文)单词和目标语言(英文)单词之间的对应关系,以及这种对应的可能性大小(用P表示)。在翻译时,会使用这些单词一级的对应,生成目标语言译文。比如,图
\ref
{
fig:4-1
}
右侧就展示了一个基于词的模型生成的翻译结果,其中
\textbf
{
s
}
和
\textbf
{
t
}
分别表示源语言和目标语言句子,单词之间的连线表示两个句子中单词一级的对应。
\parinterval
首先,回顾一下基于单词的统计翻译模型是如何完成翻译的。图
\ref
{
fig:4-1
}
展示了一个实例。其中,左侧是一个单词的``翻译表'',它记录了源语言(中文)单词和目标语言(英文)单词之间的对应关系,以及这种对应的可能性大小(用P表示)。在翻译时,会使用这些单词一级的对应,生成目标语言译文。比如,图
\ref
{
fig:4-1
}
右侧就展示了一个基于词的模型生成的翻译结果,其中
$
\mathbf
{
s
}$
和
$
\mathbf
{
t
}$
分别表示源语言和目标语言句子,单词之间的连线表示两个句子中单词一级的对应。
%----------------------------------------------
\begin{figure}
[htp]
...
...
@@ -171,7 +171,7 @@
\begin{definition}
短语
{
\small
对于一个句子
$
\
textbf
{
w
}
=
w
_
1
...w
_
n
$
,任意子串
$
w
_
i...w
_
j
$
(
$
i
\leq
j
$
且
$
0
\leq
i,j
\leq
n
$
)都是句子
\textbf
{
w
}
的一个
{
\small\bfnew
{
短语
}}
。
对于一个句子
$
\
mathbf
{
w
}
=
w
_
1
...w
_
n
$
,任意子串
$
w
_
i...w
_
j
$
(
$
i
\leq
j
$
且
$
0
\leq
i,j
\leq
n
$
)都是句子
$
\mathbf
{
w
}$
的一个
{
\small\bfnew
{
短语
}}
。
}
\end{definition}
%-------------------------------------------
...
...
@@ -183,7 +183,7 @@
\begin{definition}
句子的短语切分
{
\small
如果一个句子
$
\
textbf
{
w
}
=
w
_
1
...w
_
n
$
可以被切分为
$
m
$
个子串,则称
\textbf
{
w
}
由
$
m
$
个短语组成,记为
$
\textbf
{
w
}
=
p
_
1
...p
_
m
$
,其中
$
p
_
i
$
是
\textbf
{
w
}
的一个短语,
$
p
_
1
...p
_
m
$
也被称作句子
\textbf
{
w
}
的一个
{
\small\bfnew
{
短语切分
}}
。
如果一个句子
$
\
mathbf
{
w
}
=
w
_
1
...w
_
n
$
可以被切分为
$
m
$
个子串,则称
$
\mathbf
{
w
}$
由
$
m
$
个短语组成,记为
$
\mathbf
{
w
}
=
p
_
1
...p
_
m
$
,其中
$
p
_
i
$
是
$
\mathbf
{
w
}$
的一个短语,
$
p
_
1
...p
_
m
$
也被称作句子
$
\mathbf
{
w
}$
的一个
{
\small\bfnew
{
短语切分
}}
。
}
\end{definition}
%-------------------------------------------
...
...
@@ -203,7 +203,7 @@ p_4 &=& \text{问题}\nonumber
\begin{definition}
双语短语(或短语对)
{
\small
对于源语和目标语句对(
\textbf
{
s
}
,
\textbf
{
t
}
),
\textbf
{
s
}
中的一个短语
$
\bar
{
s
}_
i
$
和
\textbf
{
t
}
中的一个短语
$
\bar
{
t
}_
j
$
可以构成一个双语短语对(
$
\bar
{
s
}_
i,
\bar
{
t
}_
j
$
),简称
{
\small\bfnew
{
短语对
}}
\index
{
短语对
}
(
$
\bar
{
s
}_
i,
\bar
{
t
}_
j
$
)。
对于源语和目标语句对(
$
\mathbf
{
s
}$
,
$
\mathbf
{
t
}$
),
$
\mathbf
{
s
}$
中的一个短语
$
\bar
{
s
}_
i
$
和
$
\mathbf
{
t
}$
中的一个短语
$
\bar
{
t
}_
j
$
可以构成一个双语短语对(
$
\bar
{
s
}_
i,
\bar
{
t
}_
j
$
),简称
{
\small\bfnew
{
短语对
}}
\index
{
短语对
}
(
$
\bar
{
s
}_
i,
\bar
{
t
}_
j
$
)。
}
\end{definition}
%-------------------------------------------
...
...
@@ -225,12 +225,12 @@ p_4 &=& \text{问题}\nonumber
\begin{definition}
基于短语的翻译推导
{
\small
对于源语言和目标语言句对(
$
\
textbf
{
s
}
,
\textbf
{
t
}$
),分别有短语切分
$
\{\bar
{
s
}_
i
\}
$
和
$
\{\bar
{
t
}_
j
\}
$
,且
$
\{\bar
{
s
}_
i
\}
$
和
$
\{\bar
{
t
}_
j
\}
$
之间存在一一对应的关系。令
$
\{\bar
{
a
}_
j
\}
$
表示
$
\{\bar
{
t
}_
j
\}
$
中每个短语对应到源语言短语的编号,则称短语对
$
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
$
构成了
$
\textbf
{
s
}$
到
$
\textbf
{
t
}$
的
{
\small\bfnew
{
基于短语的翻译推导
}}
(简称推导),记为
$
d
(
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
,
\textbf
{
s
}
,
\text
bf
{
t
}
)
$
(简记为
$
d
(
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
)
$
或
$
d
$
)。
对于源语言和目标语言句对(
$
\
mathbf
{
s
}
,
\mathbf
{
t
}$
),分别有短语切分
$
\{\bar
{
s
}_
i
\}
$
和
$
\{\bar
{
t
}_
j
\}
$
,且
$
\{\bar
{
s
}_
i
\}
$
和
$
\{\bar
{
t
}_
j
\}
$
之间存在一一对应的关系。令
$
\{\bar
{
a
}_
j
\}
$
表示
$
\{\bar
{
t
}_
j
\}
$
中每个短语对应到源语言短语的编号,则称短语对
$
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
$
构成了
$
\mathbf
{
s
}$
到
$
\mathbf
{
t
}$
的
{
\small\bfnew
{
基于短语的翻译推导
}}
(简称推导),记为
$
d
(
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
,
\mathbf
{
s
}
,
\math
bf
{
t
}
)
$
(简记为
$
d
(
\{
(
\bar
{
s
}_{
\bar
{
a
}_
j
}
,
\bar
{
t
}_
j
)
\}
)
$
或
$
d
$
)。
}
\end{definition}
%-------------------------------------------
\parinterval
基于短语的翻译推导定义了一种从源语言短语序列到目标语言短语序列的对应,其中源语言短语序列是源语言句子的一种切分,同样的,目标语言短语序列是目标语言句子的一种切分。翻译推导提供了一种描述翻译过程的手段:对于一个源语言句子,可以找到从它出发的翻译推导,推导中短语的目标语部分就构成了译文。也就是,每个源语言句子
\textbf
{
s
}
上的一个推导
$
d
$
都蕴含着一个目标语句子
\textbf
{
t
}
。
\parinterval
基于短语的翻译推导定义了一种从源语言短语序列到目标语言短语序列的对应,其中源语言短语序列是源语言句子的一种切分,同样的,目标语言短语序列是目标语言句子的一种切分。翻译推导提供了一种描述翻译过程的手段:对于一个源语言句子,可以找到从它出发的翻译推导,推导中短语的目标语部分就构成了译文。也就是,每个源语言句子
$
\mathbf
{
s
}$
上的一个推导
$
d
$
都蕴含着一个目标语句子
$
\mathbf
{
t
}$
。
%----------------------------------------------
\begin{figure}
[htp]
...
...
@@ -247,7 +247,7 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\label
{
eq:4-1
}
\end{eqnarray}
\parinterval
到此为止,就得到了一个基于短语的翻译模型。对于每个双语句对(
$
\
textbf
{
s
}
,
\text
bf
{
t
}$
),每个翻译推导
$
d
$
都对应了一个基于短语的翻译过程。而基于短语的机器翻译的目标就是对
$
d
$
进行描述。有四个基本问题:
\parinterval
到此为止,就得到了一个基于短语的翻译模型。对于每个双语句对(
$
\
mathbf
{
s
}
,
\math
bf
{
t
}$
),每个翻译推导
$
d
$
都对应了一个基于短语的翻译过程。而基于短语的机器翻译的目标就是对
$
d
$
进行描述。有四个基本问题:
\begin{itemize}
\vspace
{
0.5em
}
...
...
@@ -257,7 +257,7 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\vspace
{
0.5em
}
\item
如何对翻译中的调序问题进行建模
\ \dash
\
即调序问题;
\vspace
{
0.5em
}
\item
如何找到输入句子
\textbf
{
s
}
的最佳译文
\ \dash
\
即解码问题。
\item
如何找到输入句子
$
\mathbf
{
s
}$
的最佳译文
\ \dash
\
即解码问题。
\vspace
{
0.5em
}
\end{itemize}
...
...
@@ -271,13 +271,13 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\parinterval
对于统计机器翻译,其目的是找到输入句子的可能性最大的译文:
\begin{eqnarray}
\hat
{
\
textbf
{
t
}}
=
\argmax
_{
\textbf
{
t
}}
\textrm
{
P
}
(
\textbf
{
t
}
|
\text
bf
{
s
}
)
\hat
{
\
mathbf
{
t
}}
=
\argmax
_{
\mathbf
{
t
}}
\textrm
{
P
}
(
\mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-2
}
\end{eqnarray}
\parinterval
公式
\ref
{
eq:4-2
}
中,
\textbf
{
s
}
是输入的源语言句子,
\textbf
{
t
}
是一个目标语译文。
$
\textrm
{
P
}
(
\textbf
{
t
}
|
\textbf
{
s
}
)
$
被称为翻译模型,它描述了把
\textbf
{
s
}
翻译为
\textbf
{
t
}
的可能性。通过
$
\argmax
\textrm
{
P
}
(
\textbf
{
t
}
|
\textbf
{
s
}
)
$
可以找到使
$
\textrm
{
P
}
(
\textbf
{
t
}
|
\textbf
{
s
}
)
$
达到最大的
\textbf
{
t
}
。
\parinterval
公式
\ref
{
eq:4-2
}
中,
$
\mathbf
{
s
}$
是输入的源语言句子,
$
\mathbf
{
t
}$
是一个目标语译文。
$
\textrm
{
P
}
(
\mathbf
{
t
}
|
\mathbf
{
s
}
)
$
被称为翻译模型,它描述了把
$
\mathbf
{
s
}$
翻译为
$
\mathbf
{
t
}$
的可能性。通过
$
\argmax
\textrm
{
P
}
(
\mathbf
{
t
}
|
\mathbf
{
s
}
)
$
可以找到使
$
\textrm
{
P
}
(
\mathbf
{
t
}
|
\mathbf
{
s
}
)
$
达到最大的
$
\mathbf
{
t
}$
。
\parinterval
这里的第一个问题是如何定义
$
\textrm
{
P
}
(
\
textbf
{
t
}
|
\textbf
{
s
}
)
$
。直接描述
$
\textrm
{
P
}
(
\textbf
{
t
}
|
\textbf
{
s
}
)
$
是非常困难的,因为
\textbf
{
s
}
和
\textbf
{
t
}
分别对应了巨大的样本空间,而在训练数据中能观测到的只是空间中的一小部分样本。直接用有限的训练数据描述这两个空间中样本的对应关系会面临着严重的数据稀疏问题。对于这个问题,常用的解决办法是把复杂的问题转化为容易计算的简单问题。
\parinterval
这里的第一个问题是如何定义
$
\textrm
{
P
}
(
\
mathbf
{
t
}
|
\mathbf
{
s
}
)
$
。直接描述
$
\textrm
{
P
}
(
\mathbf
{
t
}
|
\mathbf
{
s
}
)
$
是非常困难的,因为
$
\mathbf
{
s
}$
和
$
\mathbf
{
t
}$
分别对应了巨大的样本空间,而在训练数据中能观测到的只是空间中的一小部分样本。直接用有限的训练数据描述这两个空间中样本的对应关系会面临着严重的数据稀疏问题。对于这个问题,常用的解决办法是把复杂的问题转化为容易计算的简单问题。
%----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION
...
...
@@ -285,48 +285,48 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\subsubsection
{
基于翻译推导的建模
}
\parinterval
基于短语的翻译模型假设
\textbf
{
s
}
到
\textbf
{
t
}
的翻译可以用翻译推导进行描述,这些翻译推导都是由双语短语组成。于是,两个句子之间的映射就可以被看作是一个个短语的映射。显然短语翻译的建模要比整个句子翻译的建模简单得多。从模型上看,可以把翻译推导
$
d
$
当作是从
\textbf
{
s
}
到
\textbf
{
t
}
翻译的一种隐含结构。这种结构定义了对问题的一种描述,即翻译由一系列短语组成。根据这个假设,可以把句子的翻译概率定义为:
\parinterval
基于短语的翻译模型假设
$
\mathbf
{
s
}$
到
$
\mathbf
{
t
}$
的翻译可以用翻译推导进行描述,这些翻译推导都是由双语短语组成。于是,两个句子之间的映射就可以被看作是一个个短语的映射。显然短语翻译的建模要比整个句子翻译的建模简单得多。从模型上看,可以把翻译推导
$
d
$
当作是从
$
\mathbf
{
s
}$
到
$
\mathbf
{
t
}$
翻译的一种隐含结构。这种结构定义了对问题的一种描述,即翻译由一系列短语组成。根据这个假设,可以把句子的翻译概率定义为:
\begin{eqnarray}
\textrm
{
P
}
(
\
textbf
{
t
}
|
\textbf
{
s
}
) =
\sum
_{
d
}
\textrm
{
P
}
(d,
\textbf
{
t
}
|
\text
bf
{
s
}
)
\textrm
{
P
}
(
\
mathbf
{
t
}
|
\mathbf
{
s
}
) =
\sum
_{
d
}
\textrm
{
P
}
(d,
\mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-3
}
\end{eqnarray}
\parinterval
公式
\ref
{
eq:4-3
}
中,
$
\textrm
{
P
}
(
d,
\
textbf
{
t
}
|
\text
bf
{
s
}
)
$
表示翻译推导的概率。公式
\ref
{
eq:4-3
}
把翻译问题转化为翻译推导的生成问题。但是,由于翻译推导的数量十分巨大
\footnote
[3]
{
如果把推导看作是一种树结构,推导的数量与词串的长度成指数关系。
}
,公式
\ref
{
eq:4-3
}
的右端需要对所有可能的推导进行枚举并求和,这几乎是无法计算的。
\parinterval
公式
\ref
{
eq:4-3
}
中,
$
\textrm
{
P
}
(
d,
\
mathbf
{
t
}
|
\math
bf
{
s
}
)
$
表示翻译推导的概率。公式
\ref
{
eq:4-3
}
把翻译问题转化为翻译推导的生成问题。但是,由于翻译推导的数量十分巨大
\footnote
[3]
{
如果把推导看作是一种树结构,推导的数量与词串的长度成指数关系。
}
,公式
\ref
{
eq:4-3
}
的右端需要对所有可能的推导进行枚举并求和,这几乎是无法计算的。
\parinterval
对于这个问题,常用的解决办法是利用一个化简的模型来近似完整的模型。如果把翻译推导的全体看作一个空间
$
D
$
,可以从
$
D
$
中选取一部分样本参与计算,而不是对整个
$
D
$
进行计算。比如,可以用最好的
$
n
$
个翻译推导来代表整个空间
$
D
$
。令
$
D
_{
n
\textrm
{
-
best
}}$
表示最好的
$
n
$
个翻译推导所构成的空间,于是可以定义:
\begin{eqnarray}
\textrm
{
P
}
(
\
textbf
{
t
}
|
\textbf
{
s
}
)
\approx
\sum
_{
d
\in
D
_{
n
\textrm
{
-best
}}}
\textrm
{
P
}
(d,
\textbf
{
t
}
|
\text
bf
{
s
}
)
\textrm
{
P
}
(
\
mathbf
{
t
}
|
\mathbf
{
s
}
)
\approx
\sum
_{
d
\in
D
_{
n
\textrm
{
-best
}}}
\textrm
{
P
}
(d,
\mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-4
}
\end{eqnarray}
\parinterval
进一步,把公式
\ref
{
eq:4-4
}
带入公式
\ref
{
eq:4-2
}
,可以得到翻译的目标为:
\begin{eqnarray}
\hat
{
\
textbf
{
t
}}
=
\arg\max
_{
\textbf
{
t
}}
\sum
_{
d
\in
D
_{
n
\textrm
{
-best
}}}
\textrm
{
P
}
(d,
\textbf
{
t
}
|
\text
bf
{
s
}
)
\hat
{
\
mathbf
{
t
}}
=
\arg\max
_{
\mathbf
{
t
}}
\sum
_{
d
\in
D
_{
n
\textrm
{
-best
}}}
\textrm
{
P
}
(d,
\mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-5
}
\end{eqnarray}
\parinterval
另一种常用的方法是直接用
$
\textrm
{
P
}
(
d,
\
textbf
{
t
}
|
\text
bf
{
s
}
)
$
的最大值代表整个翻译推导的概率和。这种方法假设翻译概率是非常尖锐的,``最好''的推导会占有概率的主要部分。它被形式化为:
\parinterval
另一种常用的方法是直接用
$
\textrm
{
P
}
(
d,
\
mathbf
{
t
}
|
\math
bf
{
s
}
)
$
的最大值代表整个翻译推导的概率和。这种方法假设翻译概率是非常尖锐的,``最好''的推导会占有概率的主要部分。它被形式化为:
\begin{eqnarray}
\textrm
{
P
}
(
\
textbf
{
t
}
|
\textbf
{
s
}
)
\approx
\max
\textrm
{
P
}
(d,
\textbf
{
t
}
|
\text
bf
{
s
}
)
\textrm
{
P
}
(
\
mathbf
{
t
}
|
\mathbf
{
s
}
)
\approx
\max
\textrm
{
P
}
(d,
\mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-6
}
\end{eqnarray}
\parinterval
于是,翻译的目标可以被重新定义:
\begin{eqnarray}
\hat
{
\
textbf
{
t
}}
=
\arg\max
_{
\textbf
{
t
}}
(
\max
\textrm
{
P
}
(d,
\textbf
{
t
}
|
\text
bf
{
s
}
))
\hat
{
\
mathbf
{
t
}}
=
\arg\max
_{
\mathbf
{
t
}}
(
\max
\textrm
{
P
}
(d,
\mathbf
{
t
}
|
\math
bf
{
s
}
))
\label
{
eq:4-7
}
\end{eqnarray}
\parinterval
值得注意的是,翻译推导中蕴含着译文的信息,因此每个翻译推导都与一个译文对应。因此可以把公式
\ref
{
eq:4-7
}
所描述的问题重新定义为:
\begin{eqnarray}
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
P
}
(d,
\
textbf
{
t
}
|
\text
bf
{
s
}
)
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
P
}
(d,
\
mathbf
{
t
}
|
\math
bf
{
s
}
)
\label
{
eq:4-8
}
\end{eqnarray}
\parinterval
也就是,给定一个输入句子
\textbf
{
s
}
,找到从它出发的最优翻译推导
$
\hat
{
d
}$
,把这个翻译推导所对应的目标语词串看作最优的译文。假设函数
$
t
(
\cdot
)
$
可以返回一个推导的目标语词串,则最优译文也可以被看作是:
\parinterval
也就是,给定一个输入句子
$
\mathbf
{
s
}$
,找到从它出发的最优翻译推导
$
\hat
{
d
}$
,把这个翻译推导所对应的目标语词串看作最优的译文。假设函数
$
t
(
\cdot
)
$
可以返回一个推导的目标语词串,则最优译文也可以被看作是:
\begin{eqnarray}
\hat
{
\
text
bf
{
t
}}
= t(
\hat
{
d
}
)
\hat
{
\
math
bf
{
t
}}
= t(
\hat
{
d
}
)
\label
{
eq:4-9
}
\end{eqnarray}
...
...
@@ -338,21 +338,21 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\subsubsection
{
对数线性模型
}
\parinterval
对于如何定义
$
\textrm
{
P
}
(
d,
\
textbf
{
t
}
|
\textbf
{
s
}
)
$
有很多种思路,比如,可以把
$
d
$
拆解为若干步骤,然后对这些步骤分别建模,最后形成描述
$
d
$
的
{
\small\bfnew
{
生成式模型
}}
\index
{
生成式模型
}
(Generative Model)
\index
{
Generative Model
}
。这种方法在第三章的IBM模型中也大量使用。但是,生成式模型的每一步推导需要有严格的概率解释,这也限制了研究人员从更多的角度对
$
d
$
进行描述。这里,可以使用另外一种方法
\ \dash
\
{
\small\bfnew
{
判别式模型
}}
\index
{
判别式模型
}
(Discriminative Model)
\index
{
Discriminative Model
}
来对
$
\textrm
{
P
}
(
d,
\textbf
{
t
}
|
\text
bf
{
s
}
)
$
进行描述
\cite
{
DBLP:conf/acl/OchN02
}
。其模型形式如下:
\parinterval
对于如何定义
$
\textrm
{
P
}
(
d,
\
mathbf
{
t
}
|
\mathbf
{
s
}
)
$
有很多种思路,比如,可以把
$
d
$
拆解为若干步骤,然后对这些步骤分别建模,最后形成描述
$
d
$
的
{
\small\bfnew
{
生成式模型
}}
\index
{
生成式模型
}
(Generative Model)
\index
{
Generative Model
}
。这种方法在第三章的IBM模型中也大量使用。但是,生成式模型的每一步推导需要有严格的概率解释,这也限制了研究人员从更多的角度对
$
d
$
进行描述。这里,可以使用另外一种方法
\ \dash
\
{
\small\bfnew
{
判别式模型
}}
\index
{
判别式模型
}
(Discriminative Model)
\index
{
Discriminative Model
}
来对
$
\textrm
{
P
}
(
d,
\mathbf
{
t
}
|
\math
bf
{
s
}
)
$
进行描述
\cite
{
DBLP:conf/acl/OchN02
}
。其模型形式如下:
\begin{eqnarray}
\textrm
{
P
}
(d,
\
textbf
{
t
}
|
\textbf
{
s
}
)
&
=
&
\frac
{
\textrm
{
exp
}
(
\textrm
{
score
}
(d,
\textbf
{
t
}
,
\textbf
{
s
}
))
}{
\sum
_{
d',
\textbf
{
t
}
'
}
\textrm
{
exp
}
(
\textrm
{
score
}
(d',
\textbf
{
t
}
',
\text
bf
{
s
}
))
}
\label
{
eqa4.10
}
\\
\textrm
{
score
}
(d,
\
textbf
{
t
}
,
\textbf
{
s
}
)
&
=
&
\sum
_{
i=1
}^{
M
}
\lambda
_
i
\cdot
h
_
i (d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
\textrm
{
P
}
(d,
\
mathbf
{
t
}
|
\mathbf
{
s
}
)
&
=
&
\frac
{
\textrm
{
exp
}
(
\textrm
{
score
}
(d,
\mathbf
{
t
}
,
\mathbf
{
s
}
))
}{
\sum
_{
d',
\mathbf
{
t
}
'
}
\textrm
{
exp
}
(
\textrm
{
score
}
(d',
\mathbf
{
t
}
',
\math
bf
{
s
}
))
}
\label
{
eqa4.10
}
\\
\textrm
{
score
}
(d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
)
&
=
&
\sum
_{
i=1
}^{
M
}
\lambda
_
i
\cdot
h
_
i (d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
\label
{
eq:4-11
}
\end{eqnarray}
\parinterval
公式
\ref
{
eq:4-11
}
是一种典型的
{
\small\bfnew
{
对数线性模型
}}
\index
{
对数线性模型
}
(Log-linear Model)
\index
{
Log-linear Model
}
。所谓``对数线性''体现在对多个量求和后进行指数运算(
$
\textrm
{
exp
}
(
\cdot
)
$
),这相当于对多个因素进行乘法。公式
\ref
{
eqa4.10
}
的右端是一种归一化操作。分子部分可以被看作是一种对翻译推导
$
d
$
的对数线性建模。具体来说,对于每个
$
d
$
,用
$
M
$
个特征对其进行描述,每个特征用函数
$
h
_
i
(
d,
\
textbf
{
t
}
,
\textbf
{
s
}
)
$
表示。每个特征都对应一个权重
$
\lambda
_
i
$
,表示特征
$
i
$
的重要性。
$
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_
i
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
表示了对这些特征的线性加权和,值越大表示模型得分越高,相应的
$
d
$
和
\textbf
{
t
}
的质量越高。公式
\ref
{
eqa4.10
}
的分母部分实际上不需要计算,因为其值与求解最佳推导的过程无关。把公式
\ref
{
eqa4.10
}
带入公式
\ref
{
eq:4-8
}
得到:
\parinterval
公式
\ref
{
eq:4-11
}
是一种典型的
{
\small\bfnew
{
对数线性模型
}}
\index
{
对数线性模型
}
(Log-linear Model)
\index
{
Log-linear Model
}
。所谓``对数线性''体现在对多个量求和后进行指数运算(
$
\textrm
{
exp
}
(
\cdot
)
$
),这相当于对多个因素进行乘法。公式
\ref
{
eqa4.10
}
的右端是一种归一化操作。分子部分可以被看作是一种对翻译推导
$
d
$
的对数线性建模。具体来说,对于每个
$
d
$
,用
$
M
$
个特征对其进行描述,每个特征用函数
$
h
_
i
(
d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
)
$
表示。每个特征都对应一个权重
$
\lambda
_
i
$
,表示特征
$
i
$
的重要性。
$
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_
i
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
表示了对这些特征的线性加权和,值越大表示模型得分越高,相应的
$
d
$
和
$
\mathbf
{
t
}$
的质量越高。公式
\ref
{
eqa4.10
}
的分母部分实际上不需要计算,因为其值与求解最佳推导的过程无关。把公式
\ref
{
eqa4.10
}
带入公式
\ref
{
eq:4-8
}
得到:
\begin{eqnarray}
\hat
{
d
}
&
=
&
\arg\max
_{
d
}
\frac
{
\textrm
{
exp
}
(
\textrm
{
score
}
(d,
\
textbf
{
t
}
,
\textbf
{
s
}
))
}{
\sum
_{
d',
\textbf
{
t
}
'
}
\textrm
{
exp
}
(
\textrm
{
score
}
(d',
\textbf
{
t
}
',
\text
bf
{
s
}
))
}
\nonumber
\\
&
=
&
\arg\max
_{
d
}
\ \textrm
{
exp
}
(
\textrm
{
score
}
(d,
\
textbf
{
t
}
,
\text
bf
{
s
}
))
\hat
{
d
}
&
=
&
\arg\max
_{
d
}
\frac
{
\textrm
{
exp
}
(
\textrm
{
score
}
(d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
))
}{
\sum
_{
d',
\mathbf
{
t
}
'
}
\textrm
{
exp
}
(
\textrm
{
score
}
(d',
\mathbf
{
t
}
',
\math
bf
{
s
}
))
}
\nonumber
\\
&
=
&
\arg\max
_{
d
}
\ \textrm
{
exp
}
(
\textrm
{
score
}
(d,
\
mathbf
{
t
}
,
\math
bf
{
s
}
))
\label
{
eq:4-12
}
\end{eqnarray}
\parinterval
公式
\ref
{
eq:4-12
}
中,
$
\ \textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\
textbf
{
t
}
,
\textbf
{
s
}
))
$
表示指数化的模型得分,记为
$
\textrm
{
mscore
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
=
\textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
))
$
。于是,翻译问题就可以被描述为找到使函数
$
\textrm
{
mscore
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
达到最大的
$
d
$
。由于,
$
\textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
))
$
和
$
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
是单调一致的,因此有时也直接把
$
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
$
当做模型得分。
\parinterval
公式
\ref
{
eq:4-12
}
中,
$
\ \textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
))
$
表示指数化的模型得分,记为
$
\textrm
{
mscore
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
=
\textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
))
$
。于是,翻译问题就可以被描述为找到使函数
$
\textrm
{
mscore
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
达到最大的
$
d
$
。由于,
$
\textrm
{
exp
}
(
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
))
$
和
$
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
是单调一致的,因此有时也直接把
$
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
$
当做模型得分。
\parinterval
判别式模型最大的好处在于它可以更灵活地引入特征。系统开发者可以设计任意的特征来描述翻译,特征的设计甚至都不需要统计上的解释,比如0-1特征、计数特征等。此外,判别式模型并不需要像生成式模型那样对问题进行具有统计学意义的``分解'',更不需要对每个步骤进行严格的数学推导。相反,它直接对问题的后验概率进行建模。由于不像生成式模型那样需要引入假设来对每个生成步骤进行化简,判别式模型对问题的刻画更加直接,因此也受到自然语言处理研究者的青睐。
...
...
@@ -366,7 +366,7 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\begin{itemize}
\vspace
{
0.5em
}
\item
如何设计特征函数
$
\{
h
_
i
(
d,
\
textbf
{
t
}
|
\text
bf
{
s
}
)
\}
$
?
\item
如何设计特征函数
$
\{
h
_
i
(
d,
\
mathbf
{
t
}
|
\math
bf
{
s
}
)
\}
$
?
\vspace
{
0.5em
}
\item
如何获得最好的特征权重
$
\{\lambda
_
i
\}
$
?
\vspace
{
0.5em
}
...
...
@@ -415,7 +415,7 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\begin{definition}
与词对齐一致(兼容)的双语短语
{
\small
对于源语言句子
\textbf
{
s
}
和目标语句子
\textbf
{
t
}
,存在
\textbf
{
s
}
和
\textbf
{
t
}
之间的词对齐。如果有
$
(
\textbf
{
s
}
,
\text
bf
{
t
}
)
$
中的双语短语
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
,且
$
\bar
{
s
}$
中所有单词仅对齐到
$
\bar
{
t
}$
中的单词,同时
$
\bar
{
t
}$
中所有单词仅对齐到
$
\bar
{
s
}$
中的单词,那么称
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
与是与词对齐一致的(兼容的)双语短语。
对于源语言句子
$
\mathbf
{
s
}$
和目标语句子
$
\mathbf
{
t
}$
,存在
$
\mathbf
{
s
}$
和
$
\mathbf
{
t
}$
之间的词对齐。如果有
$
(
\mathbf
{
s
}
,
\math
bf
{
t
}
)
$
中的双语短语
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
,且
$
\bar
{
s
}$
中所有单词仅对齐到
$
\bar
{
t
}$
中的单词,同时
$
\bar
{
t
}$
中所有单词仅对齐到
$
\bar
{
s
}$
中的单词,那么称
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
与是与词对齐一致的(兼容的)双语短语。
}
\end{definition}
%-------------------------------------------
...
...
@@ -482,7 +482,7 @@ d = {(\bar{s}_{\bar{a}_1},\bar{t}_1)} \circ {(\bar{s}_{\bar{a}_2},\bar{t}_2)} \c
\label
{
eq:4-13
}
\end{eqnarray}
\parinterval
给定一个双语句对
$
(
\
textbf
{
s
}
,
\textbf
{
t
}
)
$
,
$
\textrm
{
count
}
(
\bar
{
s
}
)
$
表示短语
$
\bar
{
s
}$
在
\textbf
{
s
}
中出现的次数,
$
\textrm
{
count
}
(
\bar
{
s
}
,
\bar
{
t
}
)
$
表示双语短语
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
在
$
(
\textbf
{
s
}
,
\text
bf
{
t
}
)
$
中被抽取出来的次数。对于一个包含多个句子的语料库,
$
\textrm
{
count
}
(
\bar
{
s
}
)
$
和
$
\textrm
{
count
}
(
\bar
{
s
}
,
\bar
{
t
}
)
$
可以按句子进行累加。类似的,也可以用同样的方法,计算
$
\bar
{
t
}$
到
$
\bar
{
s
}$
的翻译概率,即
$
\textrm
{
P
}
(
\bar
{
s
}
|
\bar
{
t
}
)
$
。一般会同时使用
$
\textrm
{
P
}
(
\bar
{
t
}
|
\bar
{
s
}
)
$
和
$
\textrm
{
P
}
(
\bar
{
s
}
|
\bar
{
t
}
)
$
度量一个双语短语的好与坏。
\parinterval
给定一个双语句对
$
(
\
mathbf
{
s
}
,
\mathbf
{
t
}
)
$
,
$
\textrm
{
count
}
(
\bar
{
s
}
)
$
表示短语
$
\bar
{
s
}$
在
$
\mathbf
{
s
}$
中出现的次数,
$
\textrm
{
count
}
(
\bar
{
s
}
,
\bar
{
t
}
)
$
表示双语短语
$
(
\bar
{
s
}
,
\bar
{
t
}
)
$
在
$
(
\mathbf
{
s
}
,
\math
bf
{
t
}
)
$
中被抽取出来的次数。对于一个包含多个句子的语料库,
$
\textrm
{
count
}
(
\bar
{
s
}
)
$
和
$
\textrm
{
count
}
(
\bar
{
s
}
,
\bar
{
t
}
)
$
可以按句子进行累加。类似的,也可以用同样的方法,计算
$
\bar
{
t
}$
到
$
\bar
{
s
}$
的翻译概率,即
$
\textrm
{
P
}
(
\bar
{
s
}
|
\bar
{
t
}
)
$
。一般会同时使用
$
\textrm
{
P
}
(
\bar
{
t
}
|
\bar
{
s
}
)
$
和
$
\textrm
{
P
}
(
\bar
{
s
}
|
\bar
{
t
}
)
$
度量一个双语短语的好与坏。
\parinterval
当遇到低频短语时,短语翻译概率的估计可能会不准确。例如,短语
$
\bar
{
s
}$
和
$
\bar
{
t
}$
在语料中只出现了一次,且在一个句子中共现,那么
$
\bar
{
s
}$
到
$
\bar
{
t
}$
的翻译概率为
$
\textrm
{
P
}
(
\bar
{
t
}
|
\bar
{
s
}
)=
1
$
,这显然是不合理的,因为
$
\bar
{
s
}$
和
$
\bar
{
t
}$
的出现完全可能是偶然事件。既然直接度量双语短语的好坏会面临数据稀疏问题,一个自然的想法就是把短语拆解成单词,利用双语短语中单词翻译的好坏间接度量双语短语的好坏。为了达到这个目的,可以使用
{
\small\bfnew
{
词汇化翻译概率
}}
\index
{
词汇化翻译概率
}
(Lexical Translation Probability)
\index
{
Lexical Translation Probability
}
。前面借助词对齐信息完成了双语短语的抽取,因此,词对齐信息本身就包含了短语内部单词之间的对应关系。因此同样可以借助词对齐来计算词汇翻译概率,公式如下:
\begin{eqnarray}
...
...
@@ -575,11 +575,11 @@ dr = start_i-end_{i-1}-1
\parinterval
对于每种调序类型,都可以定义一个调序概率,如下:
\begin{eqnarray}
\textrm
{
P
}
(
\
textbf
{
o
}
|
\textbf
{
s
}
,
\textbf
{
t
}
,
\text
bf
{
a
}
) =
\prod
_{
i=1
}^{
K
}
\textrm
{
P
}
(o
_
i|
\bar
{
s
}_{
a
_
i
}
,
\bar
{
t
}_
i, a
_{
i-1
}
, a
_
i)
\textrm
{
P
}
(
\
mathbf
{
o
}
|
\mathbf
{
s
}
,
\mathbf
{
t
}
,
\math
bf
{
a
}
) =
\prod
_{
i=1
}^{
K
}
\textrm
{
P
}
(o
_
i|
\bar
{
s
}_{
a
_
i
}
,
\bar
{
t
}_
i, a
_{
i-1
}
, a
_
i)
\label
{
eq:4-16
}
\end{eqnarray}
\noindent
其中,
$
o
_
i
$
表示(目标语言)第
$
i
$
个短语的调序方向,
$
\
text
bf
{
o
}
=
\{
o
_
i
\}
$
表示短语序列的调序方向,
$
K
$
表示短语的数量。短语之间的调序概率是由双语短语以及短语对齐决定的,
$
o
$
表示调序的种类,可以取M、S、D 中的任意一种。而整个句子调序的好坏就是把相邻的短语之间的调序概率相乘(对应取log后的加法)。这样,公式
\ref
{
eq:4-16
}
把调序的好坏定义为新的特征,对于M、S、D总共就有三个特征。除了当前短语和前一个短语的调序特征,还可以定义当前短语和后一个短语的调序特征,即将上述公式中的
$
a
_{
i
-
1
}$
换成
$
a
_{
i
+
1
}$
。 于是,又可以得到三个特征。因此在MSD调序中总共可以有6个特征。
\noindent
其中,
$
o
_
i
$
表示(目标语言)第
$
i
$
个短语的调序方向,
$
\
math
bf
{
o
}
=
\{
o
_
i
\}
$
表示短语序列的调序方向,
$
K
$
表示短语的数量。短语之间的调序概率是由双语短语以及短语对齐决定的,
$
o
$
表示调序的种类,可以取M、S、D 中的任意一种。而整个句子调序的好坏就是把相邻的短语之间的调序概率相乘(对应取log后的加法)。这样,公式
\ref
{
eq:4-16
}
把调序的好坏定义为新的特征,对于M、S、D总共就有三个特征。除了当前短语和前一个短语的调序特征,还可以定义当前短语和后一个短语的调序特征,即将上述公式中的
$
a
_{
i
-
1
}$
换成
$
a
_{
i
+
1
}$
。 于是,又可以得到三个特征。因此在MSD调序中总共可以有6个特征。
\parinterval
具体实现中,通常使用词对齐对两个短语间的调序关系进行判断。图
\ref
{
fig:4-22
}
展示了这个过程。先判断短语的左上角和右上角是否存在词对齐,再根据其位置对调序类型进行划分。每个短语对应的调序概率都可以用相对频率估计进行计算。而MSD调序模型也相当于在短语表中的每个双语短语后添加6个特征。不过,调序模型一般并不会和短语表一起存储,因此在系统中通常会看到两个独立的模型文件,分别保存短语表和调序模型。
...
...
@@ -616,7 +616,7 @@ dr = start_i-end_{i-1}-1
\subsection
{
特征
}
\parinterval
基于短语的模型使用判别式模型对翻译推导进行建模,给定双语句对
$
(
\
textbf
{
s
}
,
\textbf
{
t
}
)
$
,每个翻译推导
$
d
$
都有一个模型得分,由
$
M
$
个特征线性加权得到,记为
$
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
=
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_
i
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
表示特征权重,
$
h
_
i
(
d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
$
表示特征函数(简记为
$
h
_
i
(
d
)
$
)。这些特征包含刚刚介绍过的短语翻译概率、调序模型得分等,除此之外,还包含语言模型等其他特征,它们共同组成了特征集合。这里列出了基于短语的模型中常用的特征:
\parinterval
基于短语的模型使用判别式模型对翻译推导进行建模,给定双语句对
$
(
\
mathbf
{
s
}
,
\mathbf
{
t
}
)
$
,每个翻译推导
$
d
$
都有一个模型得分,由
$
M
$
个特征线性加权得到,记为
$
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
=
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_
i
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
表示特征权重,
$
h
_
i
(
d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
$
表示特征函数(简记为
$
h
_
i
(
d
)
$
)。这些特征包含刚刚介绍过的短语翻译概率、调序模型得分等,除此之外,还包含语言模型等其他特征,它们共同组成了特征集合。这里列出了基于短语的模型中常用的特征:
\begin{itemize}
\vspace
{
0.5em
}
...
...
@@ -646,24 +646,24 @@ dr = start_i-end_{i-1}-1
\parinterval
想要得到最优的特征权重,最简单的方法是枚举所有的特征权重可能的取值,然后评价每组权重所对应的翻译性能,最后选择最优的特征权重作为调优的结果。但是特征权重是一个实数值,因此可以考虑把实数权重进行量化,即把权重看作是在固定间隔上的取值,比如,每隔0.01取值。即使是这样,同时枚举多个特征的权重也是非常耗时的工作,当特征数量增多时这种方法的效率仍然很低。
\parinterval
这里介绍一种更加高效的特征权重调优方法
$
\ \dash
\
${
\small\bfnew
{
最小错误率训练
}}
\index
{
最小错误率训练
}
(Minimum Error Rate Training
\index
{
Minimum Error Rate Training
}
,MERT)。最小错误率训练是统计机器翻译发展中代表性工作,也是从机器翻译中原创的重要技术方法之一
\cite
{
och2003minimum
}
。最小错误率训练假设:翻译结果相对于标准答案的错误是可度量的,进而可以通过降低错误数量的方式来找到最优的特征权重。假设有样本集合
$
S
=
\{
(
s
_
1
,
\
textbf
{
r
}_
1
)
,...,
(
s
_
N,
\textbf
{
r
}_
N
)
\}
$
,
$
s
_
i
$
为样本中第
$
i
$
个源语言句子,
$
\textbf
{
r
}_
i
$
为相应的参考译文。注意,
$
\textbf
{
r
}_
i
$
可以包含多个参考译文。
$
S
$
通常被称为
{
\small\bfnew
{
调优集合
}}
\index
{
调优集合
}
(Tuning Set)
\index
{
Tuning Set
}
。对于
$
S
$
中的每个源语句子
$
s
_
i
$
,机器翻译模型会解码出
$
n
$
-best推导
$
d
_{
i
}^{
\ast
}
=
\{\text
bf
{
d
}_{
ij
}^{
\ast
}
\}
$
,其中
$
d
_{
ij
}^{
\ast
}$
表示翻译源语言句子
$
s
_
i
$
时得到的第
$
j
$
个最好的推导。
$
\{
d
_{
ij
}^{
\ast
}
\}
$
可以被定义如下:
\parinterval
这里介绍一种更加高效的特征权重调优方法
$
\ \dash
\
${
\small\bfnew
{
最小错误率训练
}}
\index
{
最小错误率训练
}
(Minimum Error Rate Training
\index
{
Minimum Error Rate Training
}
,MERT)。最小错误率训练是统计机器翻译发展中代表性工作,也是从机器翻译中原创的重要技术方法之一
\cite
{
och2003minimum
}
。最小错误率训练假设:翻译结果相对于标准答案的错误是可度量的,进而可以通过降低错误数量的方式来找到最优的特征权重。假设有样本集合
$
S
=
\{
(
s
_
1
,
\
mathbf
{
r
}_
1
)
,...,
(
s
_
N,
\mathbf
{
r
}_
N
)
\}
$
,
$
s
_
i
$
为样本中第
$
i
$
个源语言句子,
$
\mathbf
{
r
}_
i
$
为相应的参考译文。注意,
$
\mathbf
{
r
}_
i
$
可以包含多个参考译文。
$
S
$
通常被称为
{
\small\bfnew
{
调优集合
}}
\index
{
调优集合
}
(Tuning Set)
\index
{
Tuning Set
}
。对于
$
S
$
中的每个源语句子
$
s
_
i
$
,机器翻译模型会解码出
$
n
$
-best推导
$
d
_{
i
}^{
\ast
}
=
\{\math
bf
{
d
}_{
ij
}^{
\ast
}
\}
$
,其中
$
d
_{
ij
}^{
\ast
}$
表示翻译源语言句子
$
s
_
i
$
时得到的第
$
j
$
个最好的推导。
$
\{
d
_{
ij
}^{
\ast
}
\}
$
可以被定义如下:
\begin{eqnarray}
\{
d
_{
ij
}^{
\ast
}
\}
=
\arg\max
_{
\{
d
_{
ij
}
\}
}
\sum
_{
i=1
}^{
M
}
\lambda
_
i
\cdot
h
_
i (d,
\
textbf
{
t
}
,
\text
bf
{
s
}
)
\{
d
_{
ij
}^{
\ast
}
\}
=
\arg\max
_{
\{
d
_{
ij
}
\}
}
\sum
_{
i=1
}^{
M
}
\lambda
_
i
\cdot
h
_
i (d,
\
mathbf
{
t
}
,
\math
bf
{
s
}
)
\label
{
eq:4-17
}
\end{eqnarray}
\parinterval
对于每个样本都可以得到
$
n
$
-best推导集合,整个数据集上的推导集合被记为
$
\
textbf
{
D
}^{
\ast
}
=
\{\textbf
{
d
}_{
1
}^{
\ast
}
,...,
\textbf
{
d
}_{
s
}^{
\ast
}
\}
$
。进一步,令所有样本的参考译文集合为
$
\textbf
{
R
}
=
\{\textbf
{
r
}_
1
,...,
\textbf
{
r
}_
N
\}
$
。最小错误率训练的目标就是降低
$
\textbf
{
D
}^{
\ast
}$
相对于
\textbf
{
R
}
的错误。也就是,通过调整不同特征的权重
$
\lambda
=
\{
\lambda
_
i
\}
$
,让错误率最小,形式化描述为:
\parinterval
对于每个样本都可以得到
$
n
$
-best推导集合,整个数据集上的推导集合被记为
$
\
mathbf
{
D
}^{
\ast
}
=
\{\mathbf
{
d
}_{
1
}^{
\ast
}
,...,
\mathbf
{
d
}_{
s
}^{
\ast
}
\}
$
。进一步,令所有样本的参考译文集合为
$
\mathbf
{
R
}
=
\{\mathbf
{
r
}_
1
,...,
\mathbf
{
r
}_
N
\}
$
。最小错误率训练的目标就是降低
$
\mathbf
{
D
}^{
\ast
}$
相对于
$
\mathbf
{
R
}$
的错误。也就是,通过调整不同特征的权重
$
\lambda
=
\{
\lambda
_
i
\}
$
,让错误率最小,形式化描述为:
\begin{eqnarray}
\lambda
^{
\ast
}
=
\arg\min
_{
\lambda
}
\textrm
{
Error
}
(
\
textbf
{
D
}^{
\ast
}
,
\text
bf
{
R
}
)
\lambda
^{
\ast
}
=
\arg\min
_{
\lambda
}
\textrm
{
Error
}
(
\
mathbf
{
D
}^{
\ast
}
,
\math
bf
{
R
}
)
\label
{
eq:4-18
}
\end{eqnarray}
%公式--------------------------------------------------------------------
\noindent
其中
\textrm
{
Error
}$
(
\cdot
)
$
是错误率函数。
\textrm
{
Error
}$
(
\cdot
)
$
的定义方式有很多,一般来说
\textrm
{
Error
}$
(
\cdot
)
$
会与机器翻译的评价指标相关,例如,词错误率(WER)、位置错误率(PER)、BLEU 值、NIST值等都可以用于
\textrm
{
Error
}$
(
\cdot
)
$
的定义。这里使用1-BLEU作为错误率函数,即
$
\textrm
{
Error
}
(
\
textbf
{
D
}^{
\ast
}
,
\textbf
{
R
}
)
=
1
-
\textrm
{
BLEU
}
(
\textbf
{
D
}^{
\ast
}
,
\text
bf
{
R
}
)
$
。则公式
\ref
{
eq:4-18
}
可改写为:
\noindent
其中
\textrm
{
Error
}$
(
\cdot
)
$
是错误率函数。
\textrm
{
Error
}$
(
\cdot
)
$
的定义方式有很多,一般来说
\textrm
{
Error
}$
(
\cdot
)
$
会与机器翻译的评价指标相关,例如,词错误率(WER)、位置错误率(PER)、BLEU 值、NIST值等都可以用于
\textrm
{
Error
}$
(
\cdot
)
$
的定义。这里使用1-BLEU作为错误率函数,即
$
\textrm
{
Error
}
(
\
mathbf
{
D
}^{
\ast
}
,
\mathbf
{
R
}
)
=
1
-
\textrm
{
BLEU
}
(
\mathbf
{
D
}^{
\ast
}
,
\math
bf
{
R
}
)
$
。则公式
\ref
{
eq:4-18
}
可改写为:
%公式--------------------------------------------------------------------
\begin{eqnarray}
\lambda
^{
\ast
}
&
=
&
\arg\min
_{
\lambda
}
\
1 -
\textrm
{
BLEU
}
(
\
textbf
{
D
}^{
\ast
}
,
\text
bf
{
R
}
)
\nonumber
\\
&
=
&
\arg\max
_{
\lambda
}
\textrm
{
BLEU
}
(
\
textbf
{
D
}^{
\ast
}
,
\text
bf
{
R
}
)
\lambda
^{
\ast
}
&
=
&
\arg\min
_{
\lambda
}
\
1 -
\textrm
{
BLEU
}
(
\
mathbf
{
D
}^{
\ast
}
,
\math
bf
{
R
}
)
\nonumber
\\
&
=
&
\arg\max
_{
\lambda
}
\textrm
{
BLEU
}
(
\
mathbf
{
D
}^{
\ast
}
,
\math
bf
{
R
}
)
\label
{
eq:4-19
}
\end{eqnarray}
%公式--------------------------------------------------------------------
...
...
@@ -700,7 +700,7 @@ dr = start_i-end_{i-1}-1
\parinterval
能否避开这些无效的权重取值点呢?再重新看一下优化的目标BLEU。实际上,当一个特征权重发生变化时,BLEU的变化只会产生在系统1-best译文发生变化的时候。那么,可以只关注使1-best译文发生变化的取值点,而其他的取值点都不会对优化的目标函数产生变化。这也就构成了线搜索的思想。
\parinterval
假设对于每个输入的句子,翻译模型生成了两个推导
$
\
text
bf
{
d
}
=
\{
d
_
1
,d
_
2
\}
$
,每个推导
$
d
$
的得分score(
$
d
$
)可以表示成关于第
$
i
$
个特征的权重
$
\lambda
_
i
$
的线性函数:
\parinterval
假设对于每个输入的句子,翻译模型生成了两个推导
$
\
math
bf
{
d
}
=
\{
d
_
1
,d
_
2
\}
$
,每个推导
$
d
$
的得分score(
$
d
$
)可以表示成关于第
$
i
$
个特征的权重
$
\lambda
_
i
$
的线性函数:
\begin{eqnarray}
\textrm
{
score
}
(d)
&
=
&
\sum
_{
k=1
}
\lambda
_
k
\cdot
h
_
k (d)
\nonumber
\\
&
=
&
h
_
i (d)
\cdot
\lambda
_
i +
\sum
_{
k
\neq
i
}
\lambda
_
k
\cdot
h
_
k (d)
\nonumber
\\
...
...
@@ -747,7 +747,7 @@ dr = start_i-end_{i-1}-1
\parinterval
解码的目的是根据模型以及输入,找到模型得分最高的推导,即:
\begin{eqnarray}
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
score
}
(d,
\
textbf
{
t
}
,
\text
bf
{
s
}
)
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
score
}
(d,
\
mathbf
{
t
}
,
\math
bf
{
s
}
)
\label
{
eq:4-21
}
\end{eqnarray}
...
...
@@ -1168,7 +1168,7 @@ y&=&\beta_0 y_{\pi_1} \beta_1 y_{\pi_2} ... \beta_{m-1} y_{\pi_m} \beta_m
\subsection
{
翻译模型及特征
}
\parinterval
在层次短语模型中,每个翻译推导都有一个模型得分
$
\textrm
{
score
}
(
d,
\
textbf
{
s
}
,
\textbf
{
t
}
)
$
。
$
\textrm
{
score
}
(
d,
\textbf
{
s
}
,
\textbf
{
t
}
)
$
是若干特征的线性加权之和:
$
\textrm
{
score
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)=
\sum
_{
i
=
1
}^
M
\lambda
_
i
\cdot
h
_
i
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
是特征权重,
$
h
_
i
(
d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
$
是特征函数。层次短语模型的特征包括与规则相关的特征和语言模型特征,如下:
\parinterval
在层次短语模型中,每个翻译推导都有一个模型得分
$
\textrm
{
score
}
(
d,
\
mathbf
{
s
}
,
\mathbf
{
t
}
)
$
。
$
\textrm
{
score
}
(
d,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
$
是若干特征的线性加权之和:
$
\textrm
{
score
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)=
\sum
_{
i
=
1
}^
M
\lambda
_
i
\cdot
h
_
i
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
是特征权重,
$
h
_
i
(
d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
$
是特征函数。层次短语模型的特征包括与规则相关的特征和语言模型特征,如下:
\parinterval
对于每一条翻译规则LHS
$
\to
\langle
\alpha
,
\beta
,
\sim
\rangle
$
,有:
...
...
@@ -1188,19 +1188,19 @@ y&=&\beta_0 y_{\pi_1} \beta_1 y_{\pi_2} ... \beta_{m-1} y_{\pi_m} \beta_m
\parinterval
这些特征可以被具体描述为:
\begin{eqnarray}
h
_
i (d,
\
textbf
{
t
}
,
\text
bf
{
s
}
)=
\sum
_{
r
\in
d
}
h
_
i (r)
h
_
i (d,
\
mathbf
{
t
}
,
\math
bf
{
s
}
)=
\sum
_{
r
\in
d
}
h
_
i (r)
\label
{
eq:4-25
}
\end{eqnarray}
\parinterval
公式
\ref
{
eq:4-25
}
中,
$
r
$
表示推导
$
d
$
中的一条规则,
$
h
_
i
(
r
)
$
表示规则
$
r
$
上的第
$
i
$
个特征。可以看出,推导
$
d
$
的特征值就是所有包含在
$
d
$
中规则的特征值的和。进一步,可以定义
\begin{eqnarray}
\textrm
{
rscore
}
(d,
\
textbf
{
t
}
,
\textbf
{
s
}
)=
\sum
_{
i=1
}^
7
\lambda
_
i
\cdot
h
_
i (d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
\textrm
{
rscore
}
(d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
)=
\sum
_{
i=1
}^
7
\lambda
_
i
\cdot
h
_
i (d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
\label
{
eq:4-26
}
\end{eqnarray}
\parinterval
最终,模型得分被定义为:
\begin{eqnarray}
\textrm
{
score
}
(d,
\
textbf
{
t
}
,
\textbf
{
s
}
)=
\textrm
{
rscore
}
(d,
\textbf
{
t
}
,
\text
bf
{
s
}
)+
\lambda
_
8
\textrm
{
log
}
(
\textrm
{
P
}_{
\textrm
{
lm
}}
(
\textrm
{
t
}
))+
\lambda
_
9
\mid
\textrm
{
t
}
\mid
\textrm
{
score
}
(d,
\
mathbf
{
t
}
,
\mathbf
{
s
}
)=
\textrm
{
rscore
}
(d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)+
\lambda
_
8
\textrm
{
log
}
(
\textrm
{
P
}_{
\textrm
{
lm
}}
(
\textrm
{
t
}
))+
\lambda
_
9
\mid
\textrm
{
t
}
\mid
\label
{
eq:4-27
}
\end{eqnarray}
...
...
@@ -1224,13 +1224,13 @@ h_i (d,\textbf{t},\textbf{s})=\sum_{r \in d}h_i (r)
\parinterval
层次短语模型解码的目标是找到模型得分最高的推导,即:
\begin{eqnarray}
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
score
}
(d,
\
textbf
{
s
}
,
\text
bf
{
t
}
)
\hat
{
d
}
=
\arg\max
_{
d
}
\textrm
{
score
}
(d,
\
mathbf
{
s
}
,
\math
bf
{
t
}
)
\label
{
eq:4-28
}
\end{eqnarray}
\parinterval
$
\hat
{
d
}$
的目标语部分即最佳译文
$
\hat
{
\
text
bf
{
t
}}$
。令函数
$
t
(
\cdot
)
$
返回翻译推导的目标语词串,于是有:
\parinterval
$
\hat
{
d
}$
的目标语部分即最佳译文
$
\hat
{
\
math
bf
{
t
}}$
。令函数
$
t
(
\cdot
)
$
返回翻译推导的目标语词串,于是有:
\begin{eqnarray}
\hat
{
\
text
bf
{
t
}}
=t(
\hat
{
d
}
)
\hat
{
\
math
bf
{
t
}}
=t(
\hat
{
d
}
)
\label
{
eq:4-29
}
\end{eqnarray}
...
...
@@ -2058,7 +2058,7 @@ r_9: \quad \textrm{IP(}\textrm{NN}_1\ \textrm{VP}_2) \rightarrow \textrm{S(}\tex
\subsection
{
句法翻译模型的特征
}
\parinterval
基于语言学句法的翻译模型使用判别式模型对翻译推导进行建模(
\ref
{
subsection-4.2.2
}
节)。给定双语句对(
\textbf
{
s
}
,
\textbf
{
t
}
),由
$
M
$
个特征经过线性加权,得到每个翻译推导
$
d
$
的得分,记为
$
\textrm
{
score
(
}
d,
\textbf
{
t
}
,
\textbf
{
s
}
)=
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_{
i
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
表示特征权重,
$
h
_{
i
}
(
d,
\textbf
{
t
}
,
\textbf
{
s
}
)
$
表示特征函数。翻译的目标就是要找到使
$
\textrm
{
score
(
}
d,
\textbf
{
t
}
,
\text
bf
{
s
}
)
$
达到最高的推导
$
d
$
。
\parinterval
基于语言学句法的翻译模型使用判别式模型对翻译推导进行建模(
\ref
{
subsection-4.2.2
}
节)。给定双语句对(
$
\mathbf
{
s
}$
,
$
\mathbf
{
t
}$
),由
$
M
$
个特征经过线性加权,得到每个翻译推导
$
d
$
的得分,记为
$
\textrm
{
score
(
}
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)=
\sum
_{
i
=
1
}^{
M
}
\lambda
_
i
\cdot
h
_{
i
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
,其中
$
\lambda
_
i
$
表示特征权重,
$
h
_{
i
}
(
d,
\mathbf
{
t
}
,
\mathbf
{
s
}
)
$
表示特征函数。翻译的目标就是要找到使
$
\textrm
{
score
(
}
d,
\mathbf
{
t
}
,
\math
bf
{
s
}
)
$
达到最高的推导
$
d
$
。
\parinterval
这里,可以使用最小错误率训练对特征权重进行调优(
\ref
{
subsection-4.2.6
}
节)。而特征函数可参考如下定义:
...
...
@@ -2099,9 +2099,9 @@ r_9: \quad \textrm{IP(}\textrm{NN}_1\ \textrm{VP}_2) \rightarrow \textrm{S(}\tex
\begin{itemize}
\vspace
{
0.5em
}
\item
(h8)语言模型,即
$
\textrm
{
P
}_{
\textrm
{
lm
}}
(
\
text
bf
{
t
}
)
$
,用于度量译文的流畅度;
\item
(h8)语言模型,即
$
\textrm
{
P
}_{
\textrm
{
lm
}}
(
\
math
bf
{
t
}
)
$
,用于度量译文的流畅度;
\vspace
{
0.5em
}
\item
(h9)译文长度,即
$
|
\
text
bf
{
t
}
|
$
,用于避免模型过于倾向生成短译文(因为短译文语言模型分数高);
\item
(h9)译文长度,即
$
|
\
math
bf
{
t
}
|
$
,用于避免模型过于倾向生成短译文(因为短译文语言模型分数高);
\vspace
{
0.5em
}
\item
(h10)翻译规则数量,学习对使用规则数量的偏好。比如,如果这个特征的权重较高,则表明系统更喜欢使用数量多的规则;
\vspace
{
0.5em
}
...
...
@@ -2205,7 +2205,7 @@ d_1 = {d'} \circ {r_5}
\parinterval
解码的目标是找到得分score(
$
d
$
)最大的推导
$
d
$
。这个过程通常被描述为:
\begin{eqnarray}
\hat
{
d
}
=
\arg\max
_
d
\textrm
{
score
}
(d,
\
textbf
{
s
}
,
\text
bf
{
t
}
)
\hat
{
d
}
=
\arg\max
_
d
\textrm
{
score
}
(d,
\
mathbf
{
s
}
,
\math
bf
{
t
}
)
\label
{
eq:4-34
}
\end{eqnarray}
...
...
Book/Chapter7/Chapter7.tex
查看文件 @
87b27ca0
...
...
@@ -1678,23 +1678,23 @@ p_l=\frac{l}{2L}\cdot \varphi
\begin{itemize}
\vspace
{
0.5em
}
\item
{
\small\bfnew
{
基于单词的知识精炼
}}
\index
{
基于单词的知识精炼
}
(Word-level Knowledge Distillation)
\index
{
Word-level Knowledge Distillation
}
。该方法的目标是使得学生模型的预测(分布)尽可能逼近教师模型的预测(分布)。令
$
\
textbf
{
x
}
=
\{
x
_
1
,
\ldots
,x
_
m
\}
$
和
$
\text
bf
{
y
}
=
\{
y
_
1
,
\ldots
,y
_
n
\}
$
分别表示输入和输出(数据中的答案)序列,
$
V
$
表示目标语言词表,
$
n
$
表示译文序列的长度,则基于单词的知识精炼的损失函数被定义为:
\item
{
\small\bfnew
{
基于单词的知识精炼
}}
\index
{
基于单词的知识精炼
}
(Word-level Knowledge Distillation)
\index
{
Word-level Knowledge Distillation
}
。该方法的目标是使得学生模型的预测(分布)尽可能逼近教师模型的预测(分布)。令
$
\
mathbf
{
x
}
=
\{
x
_
1
,
\ldots
,x
_
m
\}
$
和
$
\math
bf
{
y
}
=
\{
y
_
1
,
\ldots
,y
_
n
\}
$
分别表示输入和输出(数据中的答案)序列,
$
V
$
表示目标语言词表,
$
n
$
表示译文序列的长度,则基于单词的知识精炼的损失函数被定义为:
\begin{eqnarray}
L
_{
\textrm
{
word
}}
= -
\sum
_{
j=1
}^
n
\sum
_{
y
_
j
\in
V
}
\textrm
{
P
}_{
\textrm
{
t
}}
(y
_{
\textrm
{
j
}}
|
\
textbf
{
x
}
)
\textrm
{
logP
}_{
\textrm
{
s
}}
(y
_
j|
\text
bf
{
x
}
)
L
_{
\textrm
{
word
}}
= -
\sum
_{
j=1
}^
n
\sum
_{
y
_
j
\in
V
}
\textrm
{
P
}_{
\textrm
{
t
}}
(y
_{
\textrm
{
j
}}
|
\
mathbf
{
x
}
)
\textrm
{
logP
}_{
\textrm
{
s
}}
(y
_
j|
\math
bf
{
x
}
)
\label
{
eq:7-28
}
\end{eqnarray}
这里,
$
\textrm
{
P
}_{
\textrm
{
s
}}
(
y
_
j|
\
textbf
{
x
}
)
$
和
$
\textrm
{
P
}_{
\textrm
{
t
}}
(
y
_
i|
\text
bf
{
x
}
)
$
分别表示学生模型和教师模型在
$
j
$
位置的输出的概率。公式
\ref
{
eq:7-28
}
实际上在最小化教师模型和学生模型输出分布之间的交叉熵。
这里,
$
\textrm
{
P
}_{
\textrm
{
s
}}
(
y
_
j|
\
mathbf
{
x
}
)
$
和
$
\textrm
{
P
}_{
\textrm
{
t
}}
(
y
_
i|
\math
bf
{
x
}
)
$
分别表示学生模型和教师模型在
$
j
$
位置的输出的概率。公式
\ref
{
eq:7-28
}
实际上在最小化教师模型和学生模型输出分布之间的交叉熵。
\vspace
{
0.5em
}
\item
{
\small\bfnew
{
基于序列的知识精炼
}}
\index
{
基于序列的知识精炼
}
(Sequence-level Knowledge Distillation)
\index
{
Sequence-level Knowledge Distillation
}
。除了单词一级的拟合,基于序列的知识精炼希望在序列整体上进行拟合。其损失函数被定义为:
\begin{eqnarray}
L
_{
\textrm
{
seq
}}
= -
\sum
_{
\textrm
{
y
}}
\textrm
{
P
}_{
\textrm
{
t
}}
(
\
textbf
{
y
}
|
\textbf
{
x
}
)
\textrm
{
logP
}_{
\textrm
{
s
}}
(
\textbf
{
y
}
|
\text
bf
{
x
}
)
L
_{
\textrm
{
seq
}}
= -
\sum
_{
\textrm
{
y
}}
\textrm
{
P
}_{
\textrm
{
t
}}
(
\
mathbf
{
y
}
|
\mathbf
{
x
}
)
\textrm
{
logP
}_{
\textrm
{
s
}}
(
\mathbf
{
y
}
|
\math
bf
{
x
}
)
\label
{
eq:7-29
}
\end{eqnarray}
公式
\ref
{
eq:7-29
}
要求遍历所有可能的译文序列,并进行求和,当词表大小为
$
V
$
,序列长度为
$
L
$
时则可能的序列的数量有
$
V
$
的
$
L
$
次幂,这么多的译文将消耗大量的计算资源。因此,会考虑用教师模型的真实输出序列
$
\hat
{
\
textbf
{
y
}}$
来代替整个空间,即假设
$
\textrm
{
P
}_{
\textrm
{
t
}}
(
\hat
{
\textbf
{
y
}}
|
\text
bf
{
x
}
)=
1
$
。于是,目标函数变为:
公式
\ref
{
eq:7-29
}
要求遍历所有可能的译文序列,并进行求和,当词表大小为
$
V
$
,序列长度为
$
L
$
时则可能的序列的数量有
$
V
$
的
$
L
$
次幂,这么多的译文将消耗大量的计算资源。因此,会考虑用教师模型的真实输出序列
$
\hat
{
\
mathbf
{
y
}}$
来代替整个空间,即假设
$
\textrm
{
P
}_{
\textrm
{
t
}}
(
\hat
{
\mathbf
{
y
}}
|
\math
bf
{
x
}
)=
1
$
。于是,目标函数变为:
\begin{eqnarray}
L
_{
\textrm
{
seq
}}
= -
\textrm
{
logP
}_{
\textrm
{
s
}}
(
\hat
{
\
textbf
{
y
}}
|
\text
bf
{
x
}
)
L
_{
\textrm
{
seq
}}
= -
\textrm
{
logP
}_{
\textrm
{
s
}}
(
\hat
{
\
mathbf
{
y
}}
|
\math
bf
{
x
}
)
\label
{
eq:7-30
}
\end{eqnarray}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论