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
b9cc76d0
Commit
b9cc76d0
authored
Mar 29, 2020
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganization and minor updates
parent
3bd2ba36
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
255 行增加
和
224 行删除
+255
-224
Book/Chapter1/chapter1.tex
+3
-1
Book/Chapter6/Chapter6.tex
+0
-205
Book/ChapterAppend/ChapterAppend.tex
+230
-0
Book/mt-book-xelatex.ptc
+10
-6
Book/mt-book-xelatex.tex
+12
-12
没有找到文件。
Book/Chapter1/chapter1.tex
查看文件 @
b9cc76d0
% !Mode:: "TeX:UTF-8"
% !TEX encoding = UTF-8 Unicode
\part
{
统计建模基础
}
\part
{
机器翻译基础
}
%----------------------------------------------------------------------------------------
% CHAPTER 1
%----------------------------------------------------------------------------------------
...
...
Book/Chapter6/Chapter6.tex
查看文件 @
b9cc76d0
...
...
@@ -1817,211 +1817,6 @@ Transformer Deep(48层) & 30.2 & 43.1 & 194$\times 10^{6}$
\item
神经机器翻译依赖成本较高的GPU设备,因此对模型的裁剪和加速也是很多系统研发人员所感兴趣的方向。比如,从工程上,可以考虑减少运算强度,比如低精度浮点或者整数计算,或者引入缓存机制来加速模型的推断
\cite
{
DBLP:journals/corr/abs-1906-00532
}
\cite
{
DBLP:journals/corr/CourbariauxB16
}
;也可以通过对模型参数矩阵的剪枝,甚至对模块的剪枝,来减小整个模型的体积
\cite
{
Zhang2018SpeedingUN
}
\cite
{
DBLP:journals/corr/SeeLM16
}
;另一种方法是知识精炼。利用大模型训练小模型,这样往往可以得到比单独训练小模型更好的效果
\cite
{
DBLP:journals/corr/ChenLCL17
}
\cite
{
Hinton2015Distilling
}
\cite
{
Sun2019PatientKD
}
。
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第一章附录
\begin{appendices}
\chapter
{
附录A
}
\label
{
appendix-A
}
\end{appendices}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第二章附录
\begin{appendices}
\chapter
{
附录B
}
\label
{
appendix-B
}
\section
{
IBM模型3训练方法
}
\parinterval
模型3的参数估计与模型1和模型2采用相同的方法。这里直接给出辅助函数。
\begin{eqnarray}
h(t,d,n,p,
\lambda
,
\mu
,
\nu
,
\zeta
)
&
=
&
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
)-
\sum
_{
e
}
\lambda
_{
e
}
(
\sum
_{
s
}
t(
\mathbf
{
s
}
|
\mathbf
{
t
}
)-1)-
\sum
_{
i
}
\mu
_{
iml
}
(
\sum
_{
j
}
d(j|i,m,l)-1)
\nonumber
\\
&
&
-
\sum
_{
e
}
\nu
_{
e
}
(
\sum
_{
\varphi
}
n(
\varphi
|e)-1)-
\zeta
(p
^
0+p
^
1-1)
\label
{
eq:1.1
}
\end{eqnarray}
%----------------------------------------------
\parinterval
由于篇幅所限这里略去了推导步骤直接给出一些用于参数估计的等式。
\begin{eqnarray}
c(s|t,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
i=1
}^{
m
}
(
\delta
(s
_
i,
\mathbf
{
s
}
)
\cdot
\delta
(t
_{
a
_{
i
}}
,
\mathbf
{
t
}
)))
\label
{
eq:1.2
}
\end{eqnarray}
\begin{eqnarray}
c(i|j,m,l;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\delta
(j,a
_
i))
\label
{
eq:1.3
}
\end{eqnarray}
\begin{eqnarray}
c(
\varphi
|e;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
j=1
}^{
l
}
\delta
(
\varphi
,
\varphi
_{
j
}
)
\delta
(e,e
_
j))
\label
{
eq:1.4
}
\end{eqnarray}
\begin{eqnarray}
c(0|
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
(m-2
\varphi
_
0) )
\label
{
eq:1.5
}
\end{eqnarray}
\begin{eqnarray}
c(1|
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\varphi
_
0)
\label
{
eq:1.6
}
\end{eqnarray}
%----------------------------------------------
\parinterval
进一步,
\begin{eqnarray}
t(
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\lambda
_{
t
}^{
-1
}
\times
\sum
_{
k=1
}^{
S
}
c(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.7
}
\end{eqnarray}
\begin{eqnarray}
d(i|j,m,l) =
\mu
_{
jml
}^{
-1
}
\times
\sum
_{
k=1
}^{
S
}
c(i|j,m,l;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.8
}
\end{eqnarray}
\begin{eqnarray}
n(
\varphi
|
\mathbf
{
t
}
) =
\nu
_{
t
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\varphi
|t;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.9
}
\end{eqnarray}
\begin{eqnarray}
pk =
\zeta
^{
-1
}
\sum
_{
k=1
}^{
S
}
c(k;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.10
}
\end{eqnarray}
%----------------------------------------------
\parinterval
在模型3中,因为产出率的引入,我们并不能像在模型1和模型2中那样,在保证正确性的情况下加速参数估计的过程。这就使得每次迭代过程中,我们都不得不面对大小为
$
(
l
+
1
)
^
m
$
的词对齐空间。遍历所有
$
(
l
+
1
)
^
m
$
个词对齐所带来的高时间复杂度显然是不能被接受的。因此就要考虑是不是可以仅利用词对齐空间中的部分词对齐对这些参数进行估计。比较简单且直接的方法就是仅利用Viterbi对齐来进行参数估计。遗憾的是,在模型3中我们没有方法直接获得Viterbi对齐。这样只能采用一种折中的方法,即仅考虑那些使得
$
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
$
值较高的词对齐。这里把这部分词对齐组成的集合记为S。式(
\ref
{
eq:1.2
}
)可以被修改为,
\begin{eqnarray}
c(s|t,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
\approx
\sum
_{
\mathbf
{
a
}
\in
\mathbf
{
S
}}
(
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
i=1
}^{
m
}
(
\delta
(s
_
i,
\mathbf
{
s
}
)
\cdot
\delta
(t
_{
a
_{
i
}}
,
\mathbf
{
t
}
)))
\label
{
eq:1.11
}
\end{eqnarray}
%----------------------------------------------
\parinterval
同理可以获得式(
\ref
{
eq:1.3
}
)、式(
\ref
{
eq:1.4
}
)、式(
\ref
{
eq:1.5
}
)和式(
\ref
{
eq:1.6
}
)的修改结果。
\parinterval
在模型3中,可以如下定义
\textrm
{
S
}
\begin{eqnarray}
\textrm
{
S
}
= N(b
^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(b
_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.12
}
\end{eqnarray}
%----------------------------------------------
\parinterval
其中
$
b
^{
\infty
}
(
V
(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
2
))
$
和
$
b
_{
i
\leftrightarrow
j
}^{
\infty
}
(
V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,
2
))
$
分别是对
$
V
(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
3
)
$
和
$
V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,
3
)
$
的估计。在计算
\textrm
{
S
}
的过程中,我们需要知道一个对齐
$
\bf
{
a
}$
的邻居
$
\bf
{
a
}
'
$
的概率,即如何通过
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
$
计算
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
',
\mathbf
{
s
}
|
\mathbf
{
t
}
)
$
。在模型3总,如果
$
\bf
{
a
}$
和
$
\bf
{
a
}
'
$
区别于某个源语单词的对齐到的目标位置上(
$
a
_
j
$
不等于
$
a
_{
j
}
'
$
),那么
\begin{small}
\begin{eqnarray}
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
',
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\cdot
\frac
{
\varphi
_{
j'
}
+1
}{
\varphi
_
j
}
\cdot
\frac
{
n(
\varphi
_{
j'
}
+1|t
_{
j'
}
)
}{
n(
\varphi
_{
j'
}
|t
_{
j'
}
)
}
\cdot
\frac
{
n(
\varphi
_{
j-1
}
|t
_{
j
}
)
}{
n(
\varphi
_{
j
}
|t
_{
j
}
)
}
\cdot
\frac
{
t(s
_
i|t
_{
j'
}
)
}{
t(s
_{
i
}
|t
_{
j
}
)
}
\cdot
\frac
{
d(i|j',m,l)
}{
d(i|j,m,l)
}
\label
{
eq:1.13
}
\end{eqnarray}
\end{small}
%----------------------------------------------
\parinterval
如果
$
\bf
{
a
}$
和
$
\bf
{
a
}
'
$
区别于两个位置
$
i
_
1
$
和
$
i
_
2
$
的对齐上,
$
a
_{
j
_{
1
}}
=
a
{
j
_{
2
}}
'
$
且
$
a
_{
j
_{
2
}}
=
a
{
j
_{
1
}}
'
$
,那么
\begin{eqnarray}
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a'
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\cdot
\frac
{
t(s
_{
i
_{
2
}}
|t
_{
a
_{
i
_{
2
}}}
)
}{
t(s
_{
i
_{
1
}}
|t
_{
a
{
i
_{
1
}}}
)
}
\cdot
\frac
{
d(i
_{
2
}
)|a
{
i
_{
2
}}
,m,l)
}{
d(i
_{
1
}
|a
_{
i
_{
1
}}
,m,l)
}
\label
{
eq:1.14
}
\end{eqnarray}
%----------------------------------------------
\parinterval
这样每次迭代就可以仅在
\textrm
{
S
}
上进行计数。相比整个词对齐空间,
\textrm
{
S
}
只是一个非常小的子集,因此运算复杂度可以大大被降低。本质上说,这里定义
\textrm
{
S
}
是为了用模型2的Viterbi对齐来估计模型3的Viterbi对齐。
\parinterval
对于模型3的参数估计过程,实际上是建立在模型1和模型2的参数估计结果上的。这不仅是因为模型3要利用模型2的Viterbi对齐,而且还因为模型3参数的初值也要直接利用模型2的参数。从这个角度说,模型1,2,3是有序的且向前依赖的。单独的对模型3的参数进行估计是极其困难的。实际上IBM的模型4和模型5也具有这样的性质,即他们都可以利用前一个模型参数估计的结果作为自身参数的初始值。
\section
{
IBM模型4训练方法
}
\parinterval
模型4的参数估计基本与模型3一致。需要修改的是扭曲度的估计公式,如下:
\begin{eqnarray}
c
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.15
}
\end{eqnarray}
\begin{small}
\begin{eqnarray}
s
_
1(
\Delta
_
i|ca,cb;
\rm
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
p=1
}^
l (
\varepsilon
(
\phi
_
p)
\cdot
\delta
(
\pi
_{
p1
}
-
\odot
_{
[p]
}
,
\Delta
_
i)
\cdot
\delta
(A(e
_{
p-1
}
),ca)
\cdot
\delta
(B(
\tau
_{
p1
}
),cb))
\label
{
eq:1.16
}
\end{eqnarray}
\end{small}
\begin{eqnarray}
d
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
1cacb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
(s),
\mathbf
{
t
}
(s))
\label
{
eq:1.17
}
\end{eqnarray}
\begin{eqnarray}
c
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.18
}
\end{eqnarray}
\begin{eqnarray}
s
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
p=1
}^
l(
\varepsilon
(
\phi
_
p-1)
\sum
_{
k=2
}^{
\phi
_
p
}
\delta
(p-
\pi
_{
[p]k-1
}
,
\Delta
_
i)
\cdot
\delta
(B(
\tau
_{
[p]k
}
),cb))
\label
{
eq:1.19
}
\end{eqnarray}
\begin{eqnarray}
d
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
>1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
(s),
\mathbf
{
t
}
(s))
\label
{
eq:1.20
}
\end{eqnarray}
%----------------------------------------------
\parinterval
其中,
\begin{eqnarray}
\varepsilon
(x) =
\begin{cases}
0
&
x
\leq
0
\\
1
&
x > 0
\end{cases}
\label
{
eq:1.21
}
\end{eqnarray}
%----------------------------------------------
\parinterval
$
ca
$
和
$
cb
$
分别表示目标语和源语的某个词类。
\parinterval
模型4需要像模型3一样,通过定义一个词对齐集合
\textrm
{
S
}
,使得每次迭代都在
\textrm
{
S
}
上进行,进而降低运算量。模型4中
\textrm
{
S
}
的定义为,
\begin{eqnarray}
\textrm
{
S
}
= N(
\tilde
{
b
}^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(
\tilde
{
b
}_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.22
}
\end{eqnarray}
%----------------------------------------------
\parinterval
对于一个对齐
$
\mathbf
{
a
}$
,可用模型3对它的邻居进行排名,即按
$
\textrm
{
p
}_{
\theta
}
(
b
(
\mathbf
{
a
}
)
|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
3
)
$
排序。
$
\tilde
{
b
}
(
\mathbf
{
a
}
)
$
\\
表示这个排名表中满足
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
'|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
4
)
>
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a
}
|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
4
)
$
的最高排名的
$
\mathbf
{
a
}
'
$
。同理可知
$
\tilde
{
b
}_{
i
\leftrightarrow
j
}^{
\infty
}
(
\mathbf
{
a
}
)
$
\\
的意义。这里之所以不用模型3中采用的方法直接利用
$
b
^{
\infty
}
(
\mathbf
{
a
}
)
$
得到模型4中高概率的对齐,是因为模型4中,要想获得某个对齐
$
\mathbf
{
a
}$
的邻居
$
\mathbf
{
a
}
'
$
,必须做很大调整,比如:调整
$
\tau
_{
[
j
]
1
}$
和
$
\odot
_{
[
j
]
}$
等等。这个过程要比模型3的相应过程复杂得多。因此在模型4中只能借助于模型3的中间步骤来进行估计。
\setlength
{
\belowdisplayskip
}{
3pt
}
%调整空白大小
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section
{
IBM模型5训练方法
}
\parinterval
模型5的参数估计过程也与模型3的过程基本一致,二者的区别在于扭曲度的估计公式。在模型5中,
\begin{eqnarray}
c
_
1(
\Delta
_
i|cb,v1,v2;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
P
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_
1(
\Delta
_
i|cb,v1,v2;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.23
}
\end{eqnarray}
\begin{eqnarray}
s
_
1(
\Delta
_
i|cb,v1,v2;
\rm
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
&
=
&
\sum
_{
p=1
}^
l (
\varepsilon
(
\phi
_
p)
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,
\Delta
_
i)
\cdot
\delta
(X
_{
\{
p-1
\}
}
,v1)
\nonumber
\\
&
&
\cdot
\delta
(v
_
m-
\phi
_
p+1,v2)
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,v
_{
\pi
_{
p1-1
}}
)
\label
{
eq:1.24
}
\end{eqnarray}
\begin{eqnarray}
d
_
1(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\Delta
_
i|cb;
\mathbf
{
f
}
(s),
\mathbf
{
e
}
(s))
\label
{
eq:1.25
}
\end{eqnarray}
\begin{eqnarray}
c
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}
(
\mathbf
{
f
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\times
s
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.26
}
\end{eqnarray}
%\begin{small}
\begin{eqnarray}
s
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
&
=
&
\sum
_{
p=1
}^
l(
\varepsilon
(
\phi
_
p-1)
\sum
_{
k=2
}^{
\phi
_
p
}
(
\delta
(v
_{
\pi
_{
pk
}}
-V
_{
\pi
_{
[p]k-1
}}
,
\Delta
_
i)
\nonumber
\\
&
&
\cdot
\delta
(B(
\tau
_{
[p]k
}
) ,cb)
\cdot
\delta
(vm-v
_{
\pi
_{
p(k-1)
}}
-
\phi
_
p+k,v)
\nonumber
\\
&
&
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,v
_{
\pi
_{
p1-1
}}
)))
\label
{
eq:1.27
}
\end{eqnarray}
%\end{small}
\begin{eqnarray}
d
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
>1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
f
}
(s),
\mathbf
{
e
}
(s))
\label
{
eq:1.28
}
\end{eqnarray}
%----------------------------------------------
\vspace
{
0.5em
}
\parinterval
这里
$
X
_{
\{
p
-
1
\}
}$
表示在位置小于
$
p
$
的非空对的目标语单词对应的源语单词的平均置位。
\parinterval
从式(
\ref
{
eq:1.24
}
)中可以看出因子
$
\delta
(
v
_{
\pi
_{
p
1
}}
,v
_{
\pi
_{
p
1
-
1
}}
)
$
保证了,即使对齐
$
\mathbf
{
a
}$
不合理(一个源语位置对应多个目标语位置)也可以避免在这个不合理的对齐上计算结果。需要注意的是因子
$
\delta
(
v
_{
\pi
_{
p
1
}}
,v
_{
\pi
_{
p
1
-
1
}}
)
$
,只能保证
$
\mathbf
{
a
}$
中不合理的部分不产生坏的影响,而
$
\mathbf
{
a
}$
中其它正确的部分仍会参与迭代。
\parinterval
不过上面的参数估计过程与前面4个模型中参数估计过程并不完全一样。前面四个模型在每次迭代中,可以在给定
$
\mathbf
{
s
}$
、
$
\mathbf
{
t
}$
和一个对齐
$
\mathbf
{
a
}$
的情况下直接计算并更新参数。但是在模型5的参数估计过程中,如公式(
\ref
{
eq:1.24
}
)中,需要模拟出由
$
\mathbf
{
t
}$
生成
$
\mathbf
{
s
}$
的过程才能得到正确的结果,因为从
$
\mathbf
{
t
}$
、
$
\mathbf
{
s
}$
和
$
\mathbf
{
a
}$
中是不能直接得到 的正确结果的。具体说,就是要从目标语句子的第一个单词开始到最后一个单词结束,依次生成每个目标语单词对应的源语单词,每处理完一个目标语单词就要暂停,然后才能计算式(
\ref
{
eq:1.24
}
)中求和符号里面的内容。这也就是说即使给定了
$
\mathbf
{
s
}$
、
$
\mathbf
{
t
}$
和一个对齐
$
\mathbf
{
a
}$
,也不能直接在它们上计算,必须重新模拟
$
\mathbf
{
t
}$
到
$
\mathbf
{
s
}$
的生成过程。
\parinterval
从前面的分析可以看出,虽然模型5比模型4更精确,但是模型5过于复杂以至于给参数估计增加了巨大的计算量(对于每组
$
\mathbf
{
t
}$
、
$
\mathbf
{
s
}$
和
$
\mathbf
{
a
}$
都要模拟
$
\mathbf
{
t
}$
生成
$
\mathbf
{
s
}$
的翻译过程,时间复杂度成指数增加)。因此模型5并不具有很强的实际意义。
\parinterval
在模型5中同样需要定义一个词对齐集合S,使得每次迭代都在
\textrm
{
S
}
上进行。这里对
\textrm
{
S
}
进行如下定义
\begin{eqnarray}
\textrm
{
S
}
= N(
\tilde
{
\tilde
{
b
}}^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(
\tilde
{
\tilde
{
b
}}_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.29
}
\end{eqnarray}
\vspace
{
0.5em
}
%----------------------------------------------
\parinterval
这里
$
\tilde
{
\tilde
{
b
}}
(
\mathbf
{
a
}
)
$
借用了模型4中
$
\tilde
{
b
}
(
\mathbf
{
a
}
)
$
的概念。不过
$
\tilde
{
\tilde
{
b
}}
(
\mathbf
{
a
}
)
$
表示在利用模型3进行排名的列表中满足
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
'|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
5
)
$
的最高排名的词对齐。
\end{appendices}
...
...
Book/ChapterAppend/ChapterAppend.tex
0 → 100644
查看文件 @
b9cc76d0
% !Mode:: "TeX:UTF-8"
% !TEX encoding = UTF-8 Unicode
\part
{
附录
}
%----------------------------------------------------------------------------------------
% CHAPTER APPENDIX
%----------------------------------------------------------------------------------------
\renewcommand\figurename
{
图
}
%将figure改为图
\renewcommand\tablename
{
表
}
%将figure改为图
\chapterimage
{
chapter
_
head
_
1
}
% Chapter heading image
%------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第一章附录
\begin{appendices}
\chapter
{
附录A
}
\label
{
appendix-A
}
\end{appendices}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%第二章附录
\begin{appendices}
\chapter
{
附录B
}
\label
{
appendix-B
}
\section
{
IBM模型3训练方法
}
\parinterval
模型3的参数估计与模型1和模型2采用相同的方法。这里直接给出辅助函数。
\begin{eqnarray}
h(t,d,n,p,
\lambda
,
\mu
,
\nu
,
\zeta
)
&
=
&
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
)-
\sum
_{
e
}
\lambda
_{
e
}
(
\sum
_{
s
}
t(
\mathbf
{
s
}
|
\mathbf
{
t
}
)-1)-
\sum
_{
i
}
\mu
_{
iml
}
(
\sum
_{
j
}
d(j|i,m,l)-1)
\nonumber
\\
&
&
-
\sum
_{
e
}
\nu
_{
e
}
(
\sum
_{
\varphi
}
n(
\varphi
|e)-1)-
\zeta
(p
^
0+p
^
1-1)
\label
{
eq:1.1
}
\end{eqnarray}
%----------------------------------------------
\parinterval
由于篇幅所限这里略去了推导步骤直接给出一些用于参数估计的等式。
\begin{eqnarray}
c(s|t,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
i=1
}^{
m
}
(
\delta
(s
_
i,
\mathbf
{
s
}
)
\cdot
\delta
(t
_{
a
_{
i
}}
,
\mathbf
{
t
}
)))
\label
{
eq:1.2
}
\end{eqnarray}
\begin{eqnarray}
c(i|j,m,l;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\delta
(j,a
_
i))
\label
{
eq:1.3
}
\end{eqnarray}
\begin{eqnarray}
c(
\varphi
|e;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
j=1
}^{
l
}
\delta
(
\varphi
,
\varphi
_{
j
}
)
\delta
(e,e
_
j))
\label
{
eq:1.4
}
\end{eqnarray}
\begin{eqnarray}
c(0|
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
(m-2
\varphi
_
0) )
\label
{
eq:1.5
}
\end{eqnarray}
\begin{eqnarray}
c(1|
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\varphi
_
0)
\label
{
eq:1.6
}
\end{eqnarray}
%----------------------------------------------
\parinterval
进一步,
\begin{eqnarray}
t(
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\lambda
_{
t
}^{
-1
}
\times
\sum
_{
k=1
}^{
S
}
c(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.7
}
\end{eqnarray}
\begin{eqnarray}
d(i|j,m,l) =
\mu
_{
jml
}^{
-1
}
\times
\sum
_{
k=1
}^{
S
}
c(i|j,m,l;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.8
}
\end{eqnarray}
\begin{eqnarray}
n(
\varphi
|
\mathbf
{
t
}
) =
\nu
_{
t
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\varphi
|t;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.9
}
\end{eqnarray}
\begin{eqnarray}
pk =
\zeta
^{
-1
}
\sum
_{
k=1
}^{
S
}
c(k;
\mathbf
{
s
}
(k),
\mathbf
{
t
}
(k))
\label
{
eq:1.10
}
\end{eqnarray}
%----------------------------------------------
\parinterval
在模型3中,因为产出率的引入,我们并不能像在模型1和模型2中那样,在保证正确性的情况下加速参数估计的过程。这就使得每次迭代过程中,我们都不得不面对大小为
$
(
l
+
1
)
^
m
$
的词对齐空间。遍历所有
$
(
l
+
1
)
^
m
$
个词对齐所带来的高时间复杂度显然是不能被接受的。因此就要考虑是不是可以仅利用词对齐空间中的部分词对齐对这些参数进行估计。比较简单且直接的方法就是仅利用Viterbi对齐来进行参数估计。遗憾的是,在模型3中我们没有方法直接获得Viterbi对齐。这样只能采用一种折中的方法,即仅考虑那些使得
$
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
$
值较高的词对齐。这里把这部分词对齐组成的集合记为S。式(
\ref
{
eq:1.2
}
)可以被修改为,
\begin{eqnarray}
c(s|t,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
\approx
\sum
_{
\mathbf
{
a
}
\in
\mathbf
{
S
}}
(
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
\sum
_{
i=1
}^{
m
}
(
\delta
(s
_
i,
\mathbf
{
s
}
)
\cdot
\delta
(t
_{
a
_{
i
}}
,
\mathbf
{
t
}
)))
\label
{
eq:1.11
}
\end{eqnarray}
%----------------------------------------------
\parinterval
同理可以获得式(
\ref
{
eq:1.3
}
)、式(
\ref
{
eq:1.4
}
)、式(
\ref
{
eq:1.5
}
)和式(
\ref
{
eq:1.6
}
)的修改结果。
\parinterval
在模型3中,可以如下定义
\textrm
{
S
}
\begin{eqnarray}
\textrm
{
S
}
= N(b
^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(b
_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.12
}
\end{eqnarray}
%----------------------------------------------
\parinterval
其中
$
b
^{
\infty
}
(
V
(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
2
))
$
和
$
b
_{
i
\leftrightarrow
j
}^{
\infty
}
(
V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,
2
))
$
分别是对
$
V
(
\mathbf
{
s
}
|
\mathbf
{
t
}
;
3
)
$
和
$
V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,
3
)
$
的估计。在计算
\textrm
{
S
}
的过程中,我们需要知道一个对齐
$
\bf
{
a
}$
的邻居
$
\bf
{
a
}
'
$
的概率,即如何通过
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
$
计算
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
',
\mathbf
{
s
}
|
\mathbf
{
t
}
)
$
。在模型3总,如果
$
\bf
{
a
}$
和
$
\bf
{
a
}
'
$
区别于某个源语单词的对齐到的目标位置上(
$
a
_
j
$
不等于
$
a
_{
j
}
'
$
),那么
\begin{small}
\begin{eqnarray}
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
',
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\cdot
\frac
{
\varphi
_{
j'
}
+1
}{
\varphi
_
j
}
\cdot
\frac
{
n(
\varphi
_{
j'
}
+1|t
_{
j'
}
)
}{
n(
\varphi
_{
j'
}
|t
_{
j'
}
)
}
\cdot
\frac
{
n(
\varphi
_{
j-1
}
|t
_{
j
}
)
}{
n(
\varphi
_{
j
}
|t
_{
j
}
)
}
\cdot
\frac
{
t(s
_
i|t
_{
j'
}
)
}{
t(s
_{
i
}
|t
_{
j
}
)
}
\cdot
\frac
{
d(i|j',m,l)
}{
d(i|j,m,l)
}
\label
{
eq:1.13
}
\end{eqnarray}
\end{small}
%----------------------------------------------
\parinterval
如果
$
\bf
{
a
}$
和
$
\bf
{
a
}
'
$
区别于两个位置
$
i
_
1
$
和
$
i
_
2
$
的对齐上,
$
a
_{
j
_{
1
}}
=
a
{
j
_{
2
}}
'
$
且
$
a
_{
j
_{
2
}}
=
a
{
j
_{
1
}}
'
$
,那么
\begin{eqnarray}
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a'
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
) =
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\cdot
\frac
{
t(s
_{
i
_{
2
}}
|t
_{
a
_{
i
_{
2
}}}
)
}{
t(s
_{
i
_{
1
}}
|t
_{
a
{
i
_{
1
}}}
)
}
\cdot
\frac
{
d(i
_{
2
}
)|a
{
i
_{
2
}}
,m,l)
}{
d(i
_{
1
}
|a
_{
i
_{
1
}}
,m,l)
}
\label
{
eq:1.14
}
\end{eqnarray}
%----------------------------------------------
\parinterval
这样每次迭代就可以仅在
\textrm
{
S
}
上进行计数。相比整个词对齐空间,
\textrm
{
S
}
只是一个非常小的子集,因此运算复杂度可以大大被降低。本质上说,这里定义
\textrm
{
S
}
是为了用模型2的Viterbi对齐来估计模型3的Viterbi对齐。
\parinterval
对于模型3的参数估计过程,实际上是建立在模型1和模型2的参数估计结果上的。这不仅是因为模型3要利用模型2的Viterbi对齐,而且还因为模型3参数的初值也要直接利用模型2的参数。从这个角度说,模型1,2,3是有序的且向前依赖的。单独的对模型3的参数进行估计是极其困难的。实际上IBM的模型4和模型5也具有这样的性质,即他们都可以利用前一个模型参数估计的结果作为自身参数的初始值。
\section
{
IBM模型4训练方法
}
\parinterval
模型4的参数估计基本与模型3一致。需要修改的是扭曲度的估计公式,如下:
\begin{eqnarray}
c
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.15
}
\end{eqnarray}
\begin{small}
\begin{eqnarray}
s
_
1(
\Delta
_
i|ca,cb;
\rm
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
p=1
}^
l (
\varepsilon
(
\phi
_
p)
\cdot
\delta
(
\pi
_{
p1
}
-
\odot
_{
[p]
}
,
\Delta
_
i)
\cdot
\delta
(A(e
_{
p-1
}
),ca)
\cdot
\delta
(B(
\tau
_{
p1
}
),cb))
\label
{
eq:1.16
}
\end{eqnarray}
\end{small}
\begin{eqnarray}
d
_
1(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
1cacb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\Delta
_
i|ca,cb;
\mathbf
{
s
}
(s),
\mathbf
{
t
}
(s))
\label
{
eq:1.17
}
\end{eqnarray}
\begin{eqnarray}
c
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.18
}
\end{eqnarray}
\begin{eqnarray}
s
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
p=1
}^
l(
\varepsilon
(
\phi
_
p-1)
\sum
_{
k=2
}^{
\phi
_
p
}
\delta
(p-
\pi
_{
[p]k-1
}
,
\Delta
_
i)
\cdot
\delta
(B(
\tau
_{
[p]k
}
),cb))
\label
{
eq:1.19
}
\end{eqnarray}
\begin{eqnarray}
d
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
>1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c
_{
>1
}
(
\Delta
_
i|cb;
\mathbf
{
s
}
(s),
\mathbf
{
t
}
(s))
\label
{
eq:1.20
}
\end{eqnarray}
%----------------------------------------------
\parinterval
其中,
\begin{eqnarray}
\varepsilon
(x) =
\begin{cases}
0
&
x
\leq
0
\\
1
&
x > 0
\end{cases}
\label
{
eq:1.21
}
\end{eqnarray}
%----------------------------------------------
\parinterval
$
ca
$
和
$
cb
$
分别表示目标语和源语的某个词类。
\parinterval
模型4需要像模型3一样,通过定义一个词对齐集合
\textrm
{
S
}
,使得每次迭代都在
\textrm
{
S
}
上进行,进而降低运算量。模型4中
\textrm
{
S
}
的定义为,
\begin{eqnarray}
\textrm
{
S
}
= N(
\tilde
{
b
}^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(
\tilde
{
b
}_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.22
}
\end{eqnarray}
%----------------------------------------------
\parinterval
对于一个对齐
$
\mathbf
{
a
}$
,可用模型3对它的邻居进行排名,即按
$
\textrm
{
p
}_{
\theta
}
(
b
(
\mathbf
{
a
}
)
|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
3
)
$
排序。
$
\tilde
{
b
}
(
\mathbf
{
a
}
)
$
\\
表示这个排名表中满足
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
'|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
4
)
>
\textrm
{
P
}_{
\theta
}
(
\mathbf
{
a
}
|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
4
)
$
的最高排名的
$
\mathbf
{
a
}
'
$
。同理可知
$
\tilde
{
b
}_{
i
\leftrightarrow
j
}^{
\infty
}
(
\mathbf
{
a
}
)
$
\\
的意义。这里之所以不用模型3中采用的方法直接利用
$
b
^{
\infty
}
(
\mathbf
{
a
}
)
$
得到模型4中高概率的对齐,是因为模型4中,要想获得某个对齐
$
\mathbf
{
a
}$
的邻居
$
\mathbf
{
a
}
'
$
,必须做很大调整,比如:调整
$
\tau
_{
[
j
]
1
}$
和
$
\odot
_{
[
j
]
}$
等等。这个过程要比模型3的相应过程复杂得多。因此在模型4中只能借助于模型3的中间步骤来进行估计。
\setlength
{
\belowdisplayskip
}{
3pt
}
%调整空白大小
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section
{
IBM模型5训练方法
}
\parinterval
模型5的参数估计过程也与模型3的过程基本一致,二者的区别在于扭曲度的估计公式。在模型5中,
\begin{eqnarray}
c
_
1(
\Delta
_
i|cb,v1,v2;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
P
}
(
\mathbf
{
s
}
,
\mathbf
{
a
}
|
\mathbf
{
t
}
)
\times
s
_
1(
\Delta
_
i|cb,v1,v2;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.23
}
\end{eqnarray}
\begin{eqnarray}
s
_
1(
\Delta
_
i|cb,v1,v2;
\rm
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
&
=
&
\sum
_{
p=1
}^
l (
\varepsilon
(
\phi
_
p)
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,
\Delta
_
i)
\cdot
\delta
(X
_{
\{
p-1
\}
}
,v1)
\nonumber
\\
&
&
\cdot
\delta
(v
_
m-
\phi
_
p+1,v2)
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,v
_{
\pi
_{
p1-1
}}
)
\label
{
eq:1.24
}
\end{eqnarray}
\begin{eqnarray}
d
_
1(
\Delta
_
i|cb;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c(
\Delta
_
i|cb;
\mathbf
{
f
}
(s),
\mathbf
{
e
}
(s))
\label
{
eq:1.25
}
\end{eqnarray}
\begin{eqnarray}
c
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\sum
_{
\mathbf
{
a
}}
(
\textrm
{
p
}
(
\mathbf
{
f
}
,
\mathbf
{
s
}
|
\mathbf
{
t
}
)
\times
s
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
))
\label
{
eq:1.26
}
\end{eqnarray}
%\begin{small}
\begin{eqnarray}
s
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
a
}
,
\mathbf
{
s
}
,
\mathbf
{
t
}
)
&
=
&
\sum
_{
p=1
}^
l(
\varepsilon
(
\phi
_
p-1)
\sum
_{
k=2
}^{
\phi
_
p
}
(
\delta
(v
_{
\pi
_{
pk
}}
-V
_{
\pi
_{
[p]k-1
}}
,
\Delta
_
i)
\nonumber
\\
&
&
\cdot
\delta
(B(
\tau
_{
[p]k
}
) ,cb)
\cdot
\delta
(vm-v
_{
\pi
_{
p(k-1)
}}
-
\phi
_
p+k,v)
\nonumber
\\
&
&
\cdot
\delta
(v
_{
\pi
_{
p1
}}
,v
_{
\pi
_{
p1-1
}}
)))
\label
{
eq:1.27
}
\end{eqnarray}
%\end{small}
\begin{eqnarray}
d
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
s
}
,
\mathbf
{
t
}
) =
\mu
_{
>1cb
}^{
-1
}
\times
\sum
_{
s=1
}^{
S
}
c
_{
>1
}
(
\Delta
_
i|cb,v;
\mathbf
{
f
}
(s),
\mathbf
{
e
}
(s))
\label
{
eq:1.28
}
\end{eqnarray}
%----------------------------------------------
\vspace
{
0.5em
}
\parinterval
这里
$
X
_{
\{
p
-
1
\}
}$
表示在位置小于
$
p
$
的非空对的目标语单词对应的源语单词的平均置位。
\parinterval
从式(
\ref
{
eq:1.24
}
)中可以看出因子
$
\delta
(
v
_{
\pi
_{
p
1
}}
,v
_{
\pi
_{
p
1
-
1
}}
)
$
保证了,即使对齐
$
\mathbf
{
a
}$
不合理(一个源语位置对应多个目标语位置)也可以避免在这个不合理的对齐上计算结果。需要注意的是因子
$
\delta
(
v
_{
\pi
_{
p
1
}}
,v
_{
\pi
_{
p
1
-
1
}}
)
$
,只能保证
$
\mathbf
{
a
}$
中不合理的部分不产生坏的影响,而
$
\mathbf
{
a
}$
中其它正确的部分仍会参与迭代。
\parinterval
不过上面的参数估计过程与前面4个模型中参数估计过程并不完全一样。前面四个模型在每次迭代中,可以在给定
$
\mathbf
{
s
}$
、
$
\mathbf
{
t
}$
和一个对齐
$
\mathbf
{
a
}$
的情况下直接计算并更新参数。但是在模型5的参数估计过程中,如公式(
\ref
{
eq:1.24
}
)中,需要模拟出由
$
\mathbf
{
t
}$
生成
$
\mathbf
{
s
}$
的过程才能得到正确的结果,因为从
$
\mathbf
{
t
}$
、
$
\mathbf
{
s
}$
和
$
\mathbf
{
a
}$
中是不能直接得到 的正确结果的。具体说,就是要从目标语句子的第一个单词开始到最后一个单词结束,依次生成每个目标语单词对应的源语单词,每处理完一个目标语单词就要暂停,然后才能计算式(
\ref
{
eq:1.24
}
)中求和符号里面的内容。这也就是说即使给定了
$
\mathbf
{
s
}$
、
$
\mathbf
{
t
}$
和一个对齐
$
\mathbf
{
a
}$
,也不能直接在它们上计算,必须重新模拟
$
\mathbf
{
t
}$
到
$
\mathbf
{
s
}$
的生成过程。
\parinterval
从前面的分析可以看出,虽然模型5比模型4更精确,但是模型5过于复杂以至于给参数估计增加了巨大的计算量(对于每组
$
\mathbf
{
t
}$
、
$
\mathbf
{
s
}$
和
$
\mathbf
{
a
}$
都要模拟
$
\mathbf
{
t
}$
生成
$
\mathbf
{
s
}$
的翻译过程,时间复杂度成指数增加)。因此模型5并不具有很强的实际意义。
\parinterval
在模型5中同样需要定义一个词对齐集合S,使得每次迭代都在
\textrm
{
S
}
上进行。这里对
\textrm
{
S
}
进行如下定义
\begin{eqnarray}
\textrm
{
S
}
= N(
\tilde
{
\tilde
{
b
}}^{
\infty
}
(V(
\mathbf
{
s
}
|
\mathbf
{
t
}
;2)))
\cup
(
\mathop
{
\cup
}
\limits
_{
ij
}
N(
\tilde
{
\tilde
{
b
}}_{
i
\leftrightarrow
j
}^{
\infty
}
(V
_{
i
\leftrightarrow
j
}
(
\mathbf
{
s
}
|
\mathbf
{
t
}
,2))))
\label
{
eq:1.29
}
\end{eqnarray}
\vspace
{
0.5em
}
%----------------------------------------------
\parinterval
这里
$
\tilde
{
\tilde
{
b
}}
(
\mathbf
{
a
}
)
$
借用了模型4中
$
\tilde
{
b
}
(
\mathbf
{
a
}
)
$
的概念。不过
$
\tilde
{
\tilde
{
b
}}
(
\mathbf
{
a
}
)
$
表示在利用模型3进行排名的列表中满足
$
\textrm
{
p
}_{
\theta
}
(
\mathbf
{
a
}
'|
\mathbf
{
s
}
,
\mathbf
{
t
}
;
5
)
$
的最高排名的词对齐。
\end{appendices}
Book/mt-book-xelatex.ptc
查看文件 @
b9cc76d0
...
...
@@ -2,7 +2,7 @@
\defcounter {refsection}{0}\relax
\select@language {english}
\defcounter {refsection}{0}\relax
\contentsline {part}{\@mypartnumtocformat {I}{
统计建模
基础}}{9}{part.1}
\contentsline {part}{\@mypartnumtocformat {I}{
机器翻译
基础}}{9}{part.1}
\ttl@starttoc {default@1}
\defcounter {refsection}{0}\relax
\contentsline {chapter}{\numberline {1}机器翻译简介}{11}{chapter.1}
...
...
@@ -441,13 +441,17 @@
\defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {5.6}小结及深入阅读}{264}{section.5.6}
\defcounter {refsection}{0}\relax
\contentsline {chapter}{\numberline {A}附录A}{267}{Appendix.1.A}
\contentsline {part}{\@mypartnumtocformat {IV}{附录}}{267}{part.4}
\ttl@stoptoc {default@3}
\ttl@starttoc {default@4}
\defcounter {refsection}{0}\relax
\contentsline {chapter}{\numberline {
B}附录B}{269}{Appendix.2.B
}
\contentsline {chapter}{\numberline {
A}附录A}{269}{Appendix.1.A
}
\defcounter {refsection}{0}\relax
\contentsline {
section}{\numberline {B.1}IBM模型3训练方法}{269}{section.2.B.1
}
\contentsline {
chapter}{\numberline {B}附录B}{271}{Appendix.2.B
}
\defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {B.
2}IBM模型4训练方法}{271}{section.2.B.2
}
\contentsline {section}{\numberline {B.
1}IBM模型3训练方法}{271}{section.2.B.1
}
\defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {B.3}IBM模型5训练方法}{272}{section.2.B.3}
\contentsline {section}{\numberline {B.2}IBM模型4训练方法}{273}{section.2.B.2}
\defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {B.3}IBM模型5训练方法}{274}{section.2.B.3}
\contentsfinish
Book/mt-book-xelatex.tex
查看文件 @
b9cc76d0
...
...
@@ -26,23 +26,23 @@
%公式字体设置为计算机现代罗马
\AtBeginDocument
{
\SetSymbolFont
{
operators
}
{
normal
}{
OT1
}{
cmr
}
{
m
}{
n
}
\SetSymbolFont
{
letters
}
{
normal
}{
OML
}{
cmm
}
{
m
}{
it
}
\SetSymbolFont
{
symbols
}
{
normal
}{
OMS
}{
cmsy
}{
m
}{
n
}
\SetSymbolFont
{
operators
}{
normal
}{
OT1
}{
cmr
}
{
m
}{
n
}
\SetSymbolFont
{
letters
}{
normal
}{
OML
}{
cmm
}
{
m
}{
it
}
\SetSymbolFont
{
symbols
}{
normal
}{
OMS
}{
cmsy
}{
m
}{
n
}
\SetSymbolFont
{
largesymbols
}{
normal
}{
OMX
}{
cmex
}{
m
}{
n
}
\SetSymbolFont
{
operators
}
{
bold
}
{
OT1
}{
cmr
}
{
bx
}{
n
}
\SetSymbolFont
{
letters
}
{
bold
}
{
OML
}{
cmm
}
{
b
}{
it
}
\SetSymbolFont
{
symbols
}
{
bold
}
{
OMS
}{
cmsy
}{
b
}{
n
}
\SetSymbolFont
{
largesymbols
}{
bold
}
{
OMX
}{
cmex
}{
m
}{
n
}
\SetSymbolFont
{
operators
}
{
bold
}
{
OT1
}{
cmr
}
{
bx
}{
n
}
\SetSymbolFont
{
letters
}
{
bold
}
{
OML
}{
cmm
}
{
b
}{
it
}
\SetSymbolFont
{
symbols
}
{
bold
}
{
OMS
}{
cmsy
}{
b
}{
n
}
\SetSymbolFont
{
largesymbols
}{
bold
}{
OMX
}{
cmex
}{
m
}{
n
}
\SetMathAlphabet
{
\mathbf
}{
normal
}{
OT1
}{
cmr
}{
bx
}{
n
}
\SetMathAlphabet
{
\mathsf
}{
normal
}{
OT1
}{
cmss
}{
m
}{
n
}
\SetMathAlphabet
{
\mathit
}{
normal
}{
OT1
}{
cmr
}{
m
}{
it
}
\SetMathAlphabet
{
\mathtt
}{
normal
}{
OT1
}{
cmtt
}{
m
}{
n
}
\SetMathAlphabet
{
\mathbf
}{
bold
}
{
OT1
}{
cmr
}{
bx
}{
n
}
\SetMathAlphabet
{
\mathsf
}{
bold
}
{
OT1
}{
cmss
}{
bx
}{
n
}
\SetMathAlphabet
{
\mathit
}{
bold
}
{
OT1
}{
cmr
}{
bx
}{
it
}
\SetMathAlphabet
{
\mathtt
}{
bold
}
{
OT1
}{
cmtt
}{
m
}{
n
}
\SetMathAlphabet
{
\mathbf
}{
bold
}{
OT1
}{
cmr
}{
bx
}{
n
}
\SetMathAlphabet
{
\mathsf
}{
bold
}{
OT1
}{
cmss
}{
bx
}{
n
}
\SetMathAlphabet
{
\mathit
}{
bold
}{
OT1
}{
cmr
}{
bx
}{
it
}
\SetMathAlphabet
{
\mathtt
}{
bold
}{
OT1
}{
cmtt
}{
m
}{
n
}
}
\renewcommand
{
\baselinestretch
}{
1.2
}
%设置行间距
\begin{document}
...
...
@@ -103,7 +103,7 @@
\include
{
Chapter3/chapter3
}
\include
{
Chapter5/chapter5
}
\include
{
Chapter6/chapter6
}
\include
{
ChapterAppend/chapterappend
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论