• 検索結果がありません。

Efficient Algorithms for Inferring Geographic Transmission Probability from Large Phylogenetic Trees

N/A
N/A
Protected

Academic year: 2021

シェア "Efficient Algorithms for Inferring Geographic Transmission Probability from Large Phylogenetic Trees"

Copied!
57
0
0

読み込み中.... (全文を見る)

全文

(1)

Efficient Algorithms for Inferring

Geographic Transmission Probability from Large Phylogenetic Trees

(進化系統樹から地理的遷移確率を効率良く推定するアルゴリズム)

Fumiaki Yanagihashi

February 2011

Division of Computer Science

Graduate School of Information Science and Technology

Hokkaido University

(2)

Contents

1 Introduction 1

2 Geographic Transmission Probability Inference Problems for Phyloge-

netic Trees 5

2.1 Phylogenetic trees . . . 5

2.2 Geographic label assignments . . . 5

2.3 A Probabilistic model . . . 6

2.4 The inference problem . . . 7

3 A Viterbi Training Algorithm for Inferring Geographic Transmission Probability 9 3.1 The Viterbi training algorithm . . . 9

3.2 The algorithm VT Tree . . . 10

3.3 The procedureVT BottomUp . . . 11

3.4 The procedureVT TraceBack . . . 14

3.5 The procedureVT Estimate . . . 15

4 An EM Algorithm for Inferring Geographic Transmission Probability 17 4.1 The EM algorithm . . . 17

4.2 The algorithm EM Tree . . . 19

4.3 The procedureEM BottomUp . . . 21

4.4 The procedureEM TopDown . . . 24

4.5 The procedureEM ExpectedCount . . . 28

4.6 The procedureEM Estimate . . . 33

4.7 Extension with prior distribution . . . 34

5 Experiments 36 5.1 Data and methods . . . 36

(3)

5.2 Preliminary experiments . . . 39

5.3 Experiments on artificial datasets . . . 39

5.4 Experiments on real datasets . . . 41

6 Conclusion 42 7 Appendix 44 7.1 Basics of probability theory . . . 44

7.1.1 Probabilistic space . . . 44

7.1.2 Conditional probability and independence . . . 45

7.1.3 Random variables and distribution functions . . . 46

7.1.4 Expectations . . . 48

Bibliography 51

(4)

Abstruct

This thesis studies the statistical learning problem of the geographic transmission prob- ability (GTP) of influenza viruses from large phylogenetic trees. First we propose a probabilistic model for the problem in the framework of hierarchical Bayesian models.

Then, we present a Viterbi training algorithm and an expectation maximization (EM) algorithm for inferring a GTP from input phylogenetic trees and its geographic label assignments for its leaves. Finally, we show experimental results on artificial and real data to evaluate the performance of the proposed algorithms.

(5)

Chapter 1 Introduction

Every year, influenza A virus causes epidemics all over the world and is responsible for 250,000 to 500,000 deaths annually [12]. Understanding the characteristics of geographic transmission of influenza viruses is very important for the optimal surveillance and selec- tion of vaccine strains. For example, a key question for this problem is whether viruses remain locally and cause epidemics independently at each location between each epi- demics or whether viruses migrate from a location to other location and cause epidemics between each epidemics [1, 10, 11, 13, 15].

To find the characteristics of geographic transmission of influenza viruses, in this thesis, we consider the inference of the geographic transmission probability(GTP), which describes circulation pattern of influenza viruses in the world from large phylogenetic trees. Given a set ∆ = {1, . . . , m} of locations (or geographic labels), the GTP is the conditional probability of transmitting a virus from a source location a ∆ to a destination location b∈∆, which is given by anm×m conditional probability matrixθ, called the GTP table as shown in Fig. 1.2 (right). For example, Fig. 1.1 is a circulation pattern of influenza viruses, which is obtained from GTP table of real virus sequences by experiments in Chapter 5.

For this purpose, we use the information available from the phylogenetic trees. Let S = {s1, . . . , sn} be an input collection of n virus sequences, where n 1. Then, a phylogenetic tree(or anevolutionary tree) [8] forSis a rooted binary treeT = (V, E, root) that represents an inferred evolutionary relationship of S as shown in Fig. 1.2 (left). T has n1 internal nodes corresponding to the virtual ancestral sequences and n2 leaves corresponding to the real sequences inS. Each edge (x, y) means thatyis obtained from x by mutation. In addition, each leaf z is labeled by a location g(z) ∆ where the

(6)

corresponding sequence is sampled.

The organization of this thesis is as follows. In Chapter 2, we define a statistical model for generating geographic label assignments for a given phylogenetic tree. In Chapter 3, we present a Viterbi training algorithm [5] VT Tree for inferring the GTP for an input tree consisting of n=n1+n2 nodes, and anm×m cost matrix over a label alphabet of size m. The computation time of the algorithm is O(m2n) time by using dynamic pro- gramming [3]. In Chapter 4, we present an expectation maximization (EM) algorithm [4]

EM Tree for inferring the GTP more efficiently than VT Tree. The computation time of each iteration for inferring the GTP isO(m2n) time by using dynamic programming. In Chapter 5, we apply our algorithms to the phylogenetic tree of influenza viruses, then we estimate the GTP of influenza viruses. In Chapter 6, we conclude this thesis.

Contribution of this thesis is summarized as follows.

1. We propose a probabilistic model for label propagation on a binary tree with a given transmission probability.

2. We present two statistical inference algorithm based on Viterbi training and EM al- gorithm that infer the unknown transmission probability from given external labels.

By using dynamic programming, these algorithms work efficiently.

3. We apply the proposed algorithms to the inference of global circulation patterns of influenza viruses, and evaluate their effectiveness by experiments on artificial and real datasets.

The contents of Chapter 3 was presented in the 16th Special Interest Group on Bioin- formatics [17] and in the 20th international conference on genome informatics [16]. The contents of Chapter 4 was presented in the 80th Special Interest Group on Fundamental Problems in Artificial Intelligence [18].

(7)

Figure 1.1: A map with the geographic transmission probability (GTP) of H3N2 in- fluenza virus.

(8)

From \ To A B

A 0.8 0.2

B 0.2 0.8

Figure 1.2: An example of a phylogenetic tree T (left) and an GTP table θ (right) on an alphabet ∆ ={A, B}of locations.

(9)

Chapter 2

Geographic Transmission Probability

Inference Problems for Phylogenetic Trees

2.1 Phylogenetic trees

In this chapter, we give basic definitions and notations. We define a generative model for geographic label assignments to the nodes of a given phylogenetic tree (Figure 1.2 left) as a graphical model [2, 5]. Let ∆ = {1, . . . , m} be an alphabet of m geographic labels such as Asia, North-America, South-America, Oceania, and Europe where the virus sequences are sampled. Suppose that T is a phylogenetic tree with n1 internal nodes in VI = {1, . . . , n1} and n2 leaves in VL = {n1 + 1, . . . , n1 +n2}. We denote by V(T) = V =VI ∪VL the set of nodes. We denote by E(T) = E the set of edges in T. Let n = n1 +n2 be the total size of T. For nodes x and y in T, if there is a directed edge from xto ythen we write x≤y and say thatx is the parent of y(or y is a child of x). If x≤y and =y then we write x < y.

For a node x, we denote by xL and xR the left and right children of x, respectively.

We denote by x the sibling of x such that =x.

2.2 Geographic label assignments

Internal and external label assignments are mappings f : VI ∆ and g : VL ∆ that assign geographic labels of ∆ to internal nodes and leaves, respectively.

LetX = (xi)ni=11 andZ = (zj)nj=n1+n2

1+1be the vectors ofn1 internal labels andn2external labels, respectively. Then, xi and zj (i VI, j VL) represent the labels assigned by f andg to thei-th internal node and the j-th leaf ofT, respectively. The index 0 represent

(10)

the root of T

We sometimes do not distinguish a node i from its label xi =a∈∆ if the index i is clear from context. We introduce notations below, which will be convenient to describe our algorithms. Recall thatZ is the set of all leaves (and their label assignment). For an internal nodex and a setY (X∪Z) of nodes, we define the set of all descendants ofx byYx ={y∈Y |x≤y}. Thus,Tx denotes the subtree ofT rooted atx, andZx denotes the set of all leaves below x. Furthermore, we denote the set of all leaves that are not below x by Zx = Z\Zx. Again, we identify the sets Zx and Zx with the corresponding label assignments if it is clear from context. Let X and Z be internal and external label assignments to T. For any pair (a, b) 2 of labels, we denote by N(a, b|X, Z) the number of edges e = (xi, xj) in T that have the labels xi = a and xj = b. That is, N(a, b|X, Z) = |{(xi, xj)∈E(T)|xi =a, xj =b}|. We define N(a|X) by 1 if the label of the root is a, and 0 otherwise.

2.3 A Probabilistic model

We introduce a probabilistic model for the geographic transmission probability (GTP) inference problem, which generates internal and external label assignments from a set of input parameters called the GTP table. This model is a generalization of the hidden Markov model (HMM) [5] on sequences to a generative model on phylogenetic trees.

We define a GTP table as a set of parameters Θ = (ρ, θ) defined as follows. Theroot probability (RP), the probability of the root labelx0 is given by

q(x0) =q(x0=a|ρ) = ρa, (2.1)

where a∈∆ is the label assigned to x0 and ρ= (ρa)a is an m-vector with ρa0 and

aρa = 1. The geographic transmission probability (GTP), the conditional probability for the label xi =b of nodei and the label xπ(i)=a of its parent π(i), is given by

p(xi|xπ(i)) =p(xi=b|xπ(i)=a, θ) = θab, (2.2) where a, b∈ ∆ are the labels assigned to xπ(i), xi, respectively, and θ = (θab)a,b is an m×m-matrix with θab 0 and ∑

bθab = 1.

LetX andZ be the sets of all ofn1 internal nodes and all ofn2 leaves with their label assignments, respectively. Then, our probabilistic model is given by the joint probability

(11)

distribution for X and Z:

p(X, Z|Θ)

= p(Z|X,Θ)p(X|Θ) (2.3)

= q(x0 |ρ)

n1

i=1

p(xi|xπ(i), θ)

n1+n2

j=n1+1

p(zj|xπ(j), θ)

In what follows, we omit the parameter Θ such asp(X, Z) = p(Z|X)p(X) if no confusion arises.

Given a fixed external label assignment Z, we have the following Markov properties on the label assignment f and g, where x, y and z are any nodes of T: (1) If x is the parent ofyand z, thenp(z|x, y) = p(z|x). (2) Ifx is the parent ofyand yis the parent of z, then p(z|x, y) = p(z|y).

2.4 The inference problem

Our final goal is to infer an plausible GTP table Θ = (ρ, θ) from a given external label assignment Z for a phylogenetic tree T by the maximum likelihood estimation (ML-estimation) [2]. Formally, this problem is stated as follows.

The Geographic Transmission Probability Inference Problem from a Phylogenetic Tree (GTPIP):

Input: A phylogenetic tree T, an geographic label assignmentZ to the leaves of T (an external label assignment).

Task: Find the optimal GTP ˆΘ = (ρ, θ) that maximizes the likelihood of Z given Θ defined byˆ

p(Z|Θ) =ˆ ∑

X

p(X, Z|Θ),ˆ (2.4)

where X is a geographic label assignment to the internal nodes of T (an internal label assignment).

In other words, this problem is equivalent to find GTP ˆΘ by Θ = arg maxˆ

Θ p(Z|Θ)ˆ

= arg max

Θ

X

p(X, Z|Θ).ˆ (2.5)

(12)

By convention, instead of the maximization of the likelihood p(Z |Θ), we use theˆ minimization of the negative log likelihood ℓ(Z), defined by

ℓ(Z) =ℓ(Z|Θ) =ˆ logp(Z|Θ).ˆ (2.6) To estimate Θ, we compute all label assignmentXfor internal nodes. Since the latent variable X can take exponentially many distinct label assignments, we cannot directly find the optimal Θ. To solve this problem, we use the VT Tree algorithm and EM Tree algorithm in the following sections.

(13)

Chapter 3

A Viterbi Training Algorithm for Inferring Geographic Transmission Probability

In this chapter, we present the VT Tree algorithm for inferring the geographic transmis- sion probability (GTP) Θ = (ρ, θ) by using the Viterbi training algorithm.

3.1 The Viterbi training algorithm

Our problem is to find the optimal GTP ˆΘ = (ρ, θ) that maximizes the likelihood p(Z|Θ) ofˆ Z given ˆΘ. In other words, this problem is equivalent to find GTP ˆΘ by

Θ = arg maxˆ

Θ p(Z|Θ)ˆ

= arg max

Θ

X

p(X, Z|Θ),ˆ (3.1)

where X is a geographic label assignment for the internal nodes of T (an internal label assignment).

Since X can take exponentially many distinct values, it is hard to directly compute the optimal Θ. The Viterbi training algorithm is a greedy algorithm for computing Θ.

Given a phylogenetic treeT and the geographic label assignmentZ for its leaves as input, this algorithm first computes the best label assignment ˆX for its internal nodes, and then computes the best parameter Θ = (ρ, θ) that maximizes the likelihood p( ˆX, Z |Θ) by using ML-estimation assuming the fixed ˆX.

We give the algorithm scheme of the Viterbi training algorithm below.

The Viterbi training algorithm

Input: A phylogenetic tree T, an geographic label assignmentZ to the leaves of T (an external label assignment).

(14)

Algorithm VT Tree(∆ = {1, . . . , m}: a label alphabet, T: a phylogenetic tree, Z: a label assignment for leaves of T, Θ0= (ρ0, θ0): initial parameters):

1: (ρ, θ) = (ρ0, θ0)

2: M C =VT BottomUp(root, ρ, θ);

3: BL =VT TraceBack(root, M C);

4: (ρ, θ) =VT Estimate(root, BL);

5: return Θ = (ρ, θ);

Figure 3.1: The algorithm VT Tree

Step 1: Find the best ˆX from Z and Θ0 by maximizing p( ˆX, Z | Θ0), by the maximum likelihood method, that is, to find

Xˆ = arg max

X p(X, Z |Θ0) (3.2)

= arg min

X {−logp(X, Z|Θ0)} (3.3)

= arg min

X ℓ(X, Z|Θ0), (3.4)

where we define ℓ(X, Z|Θ0) = logp(X, Z|Θ0) and call it the cost of X.

Step 2: Find the optimal ˆΘ that maximized the likelihood p( ˆX, Z|Θ) of ˆˆ X and Z given ˆΘ, that is, to find

Θ = arg maxˆ

Θ p( ˆX, Z|Θ) (3.5)

= arg min

Θ

{logp( ˆX, Z|Θ) }

. (3.6)

The concept of Viterbi algorithms was originally introduced in learning of hidden Markov models (HMM) [5]. In the original algorithm for HMM, the name of the Viterbi training algorithm came from the fact that Step 1 uses the Viterbi algorithm [5] for computing the most likely state sequence of an HMM on a given input sequence.

3.2 The algorithm VT Tree

Based on the algorithm scheme of the Viterbi training algorithm, we show our al- gorithm VT Tree in Fig. 3.1. This algorithm computes the parameter Θ from a given

(15)

external label assignmentZ as observed variables on an input phylogenetic treeT by us- ing the Viterbi training algorithm. In theVT Tree, firstly the subprocedureVT BottomUp computes dynamic programming (DP) table M C which represent the minimum cost of Tx, by traversingT from the leaves to the root. Secondly, the subprocedureVT TraceBack computes the best label assignmentBLfor its internal nodes from tablesM C, by travers- ing T from the root to the leaves. Finally, the subprocedure VT Estimate computes the values of Θ = (ρ, θ) from BL.

The VT Tree consists of two parts. The first part corresponds to Step 1 in the algo- rithm scheme of Viterbi training algorithm and consist of the procedures VT BottomUp and VT TraceBack. In this part, the procedures together computes the best label assign- ment ˆX that minimize the cost ℓ( ˆX, Z|Θ) given by

ℓ( ˆX, Z|Θ)

= logp( ˆX, Z|Θ) (3.7)

= Ix0 +

n1

i=1

Dxixπ(i)+

n1+n2

j=n1+1

Dzjxπ(j),

whereIx =logq(x|Θ) andDxz =logp(x|z,Θ). In Fig. 3.1 the procedures solve this problem by using dynamic programming (DP) [3] on an input phylogenetic tree. We see that the procedures in this part are a generalization of the Viterbi algorithm for HMMs to that for phylogenetic tree. The second part corresponds to Step 2 in the algorithm scheme of the Viterbi training algorithm and consist of the procedure VT Estimate. In this part, the procedure computes the values of Θ = (ρ, θ) that maximized the likelihood p( ˆX, Z|Θ) of ˆˆ X and Z given ˆΘ by using ML-estimation.

In the rest of this chapter, we fix the label assignment Z for leaves.

3.3 The procedure VT BottomUp

In Fig.3.2, we show the subprocedure VT BottomUp for computing theM C table by traversing T in a bottom-up manner. M C[x][a] stores the minimum cost of the subtree Tx with the root label a∈∆ over all label assignments.

Now, we give a recurrence formula for computing M C as follows.

Lemma 1 (recurrence for M C) For any node x and any a∈∆, the following hold:

(16)

ProcedureVT BottomUp(x: node, (ρ, θ): parameters):

1: if x is leaf then

2: for all labela∈do 3: if a=g(x) then 4: M C[x][a] = 0

5: else

6: M C[x][a] = 7: end if

8: end for 9: else

10: for all x’s childu do 11: VT BottomUp(u, ρ, θ);

12: end for

13: for all labela∈do 14: for allx’s childido

15: M Cia= min{Dab+M C[xi][b]b∈}; 16: M C[x][a] =∑

iM Cia; 17: end for

18: end for 19: end if 20: return M C;

Figure 3.2: The procedure VT BottomUp

(17)

1. If x is a leaf, then

M C[x][a] =





0 if a=g(x)

otherwise.

2. If x is an internal node, then M C[x][a] =

i

min{Dab+M C[xi][b]|b∈}

Proof: We suppose that each of the cost M C[xi][b] to the subproblem used within the optimal costM[x][a] to the original problem is not optimal. By replacing the nonoptimal cost of the subproblem by the optimal one, we can get a better cost to the original problem. It is contradicting our supposition that we already had an optimal solution to the original problem. Therefore, the cost to the subproblem used within the optimal cost to the original problem is optimal and then we can compute the optimal cost of the original problem M C[x][a] by the recurrence equation as above.

By the above recurrence, we have the following lemma.

Lemma 2 The procedureVT BottomUpin Fig. 3.2 correctly computes the tableM C[x][a]

for any node x and labela∈for a phylogenetic tree T and the leaf label assignmentZ. Proof: In Fig. 3.2, for a node x, the procedure VT BottomUp computes the table M C[x][a] correctly for any labela from line 2 to line 8 (ifx is a leaf) and from line 13 to line 18 (if x is an internal node) by Lemma 1. And then, since the procedure visits all nodes from leaves to the root from line 10 to line 12, the procedure correctly computes the table M C[x][a] for any node x and labela.

Lemma 3 The procedure VT BottomUp in Fig. 3.2 runs in O(m2n) time on T.

Proof: Firstly, for a labela, the procedure VT BottomUpin Fig. 3.2 computesM Ciain O(m) time at line 15. Then, the procedure iteratively computes M C[x][a] for a node x for each label a, in O(m2) time from line 13 to line 18. Finally, the procedure iteratively visits all nodes x and computesM C[x][a]. Therefore, the procedure VT BottomUp runs in O(m2n) time.

(18)

ProcedureVT TraceBack(x: node, M C):

1: if x is leaf then 2: BL[x] :=g(x);

3: else

4: BL[x] =argmina{M C[x][a]|a∈} 5: for all x’s childu do

6: VT TraceBack(u, M C);

7: end if 8: return BL;

Figure 3.3: The procedure VT TraceBack

3.4 The procedure VT TraceBack

In Fig.3.3, we show the subprocedure VT TraceBack for computing the best label assignment BL[x] for node xby traversing T in a top-down manner.

Now, we give a formula for computing BL as follows.

Lemma 4 (formula for BL) For any node x and any a∈∆, the following hold:

1. If x is a leaf then BL[x] =g(x).

2. If x is an internal node, then

BL[x] = arg min

a {M C[x][a]|a∈}.

Lemma 5 The procedure VT TraceBack in Fig. 3.3 correctly computes the table BL[x]

for any node x and label a∈for a phylogenetic tree T and the table M C.

Proof: In Fig. 3.3, for a nodex, the procedureVT TraceBackcomputes the tableBL[x]

correctly at line 2 (if x is a leaf) and at line 4 (if x is an internal node) by Lemma 4.

Then, since the procedure visits all nodes from the root to leaves from line 5 to line 6, the procedure correctly computes the table BL[x] for any node x.

Lemma 6 The procedure VT TraceBack in Fig. 3.3 runs in O(mn) time on T.

(19)

Procedure VT Estimate(x: node, BL):

1: For every a, b∈∆, compute θab by:

θab = A[a, b]

b(A[a, b]);

2: For every a∈∆, computeρa by:

ρa = R[a]

a(R[a]);

3: return (ρ, θ);

Figure 3.4: The procedure VT Estimate

Proof: In Fig. 3.3, for each nodex, the procedureVT TraceBackfind the label a which minimize the costBL[x] inO(m) time. Then, the procedure iteratively visits all nodesx and computes the tables BL[x]. Therefore, the procedure VT TraceBack runs in O(mn) time.

3.5 The procedure VT Estimate

In this section, we present the procedure VT Estimate which find the optimal ˆΘ = (ρ, θ) that maximized the likelihood p( ˆX, Z |Θ) of ˆˆ X and Z given ˆΘ by using ML estimation.

Now, we define an m×m matrix A[·][·], called the edge count table and an m-vector R[·], called the root count table as follows. For every pairs of labels a, b∈∆, we define the value A[a][b] which is defined by the number of edges e = (xi, xj) having the labels xi = a and xj = b ∆. We can compute the A[a][b] for all pairs of labels a, b ∆ by directly counting the number of edges, from the best label assignment BL for internal nodes. For any labels a ∆, we define the value R[a] which is defined by the number of the root x0 having the labels x0 = a. We can compute the R[a] from the best label assignment BL for root node.

In Fig.3.4, we show the procedure VT Estimate for updating the values of Θ = (ρ, θ) from these vectors A and R by using ML estimation.

(20)

Lemma 7 The procedure VT Estimate in Fig. 3.4 runs in O(m2) time.

Proof: In Fig. 3.4, the procedure VT Estimate computes the parameter θab for each label a, b∈∆ in O(m2) time at line 1. Therefore, the result follows.

Theorem 8 The algorithmVT Treeof Fig. 3.1 takes O(m2n) time andO(mn)space on T, where m =||is the size of a label alphabet and n =O(||T ||) is the number of leaves.

Proof: Since each node x has the m-vector M C, VT Tree takes O(mn) space. Then, by Lemma 3, Lemma 6, and Lemma 7, VT Tree takes O(m2n) time.

(21)

Chapter 4

An EM Algorithm for Inferring Geographic Transmission Probability

In this chapter, we present the EM Treealgorithm for inferring the geographic transmis- sion probability (GTP) Θ = (ρ, θ) by using the EM algorithm.

4.1 The EM algorithm

Our problem is to find the optimal GTP ˆΘ = (ρ, θ) that maximizes the likelihood p(Z|Θ) ofˆ Z given ˆΘ as described in section 2.4. In other words, this problem is equivalent to find GTP ˆΘ by

Θ = arg maxˆ

Θ p(Z|Θ)ˆ

= arg max

Θ

X

p(X, Z|Θ),ˆ (4.1)

where X is a geographic label assignment to the internal nodes of T (an internal label assignment).

Since X can take exponentially many distinct values, it is hard to directly compute the optimal Θ. To solve this problem, we propose our algorithm EM Tree based on a general algorithmic scheme forexpectation maximization(EM) algorithms (e.g., [4, 5, 7]).

The learning parameters to the algorithm are an initial model parameter Θ0 = (ρ0, θ0) for GTP and a threshold ε > 0 for convergence. Given a phylogenetic tree T and a geographic label assignmentZ for its leaves as inputs, starting from the initial parameter Θ0 = (ρ0, θ0), the algorithm EM Tree iteratively computes the improved parameter Θ = (ρ, θ) that locally maximizes the likelihood p(Z |Θ) among all possible Θ by using ML- estimation.

(22)

We give the algorithm scheme of the EM algorithm below.

The Expectation Maximization algorithm

Input: A phylogenetic tree T, a geographic label assignment Z to the leaves of T (an external label assignment), an initial model parameter Θ0, a threshold for convergence ε.

Step 1: Initialize the GTP Θ0 = (ρ0, θ0).

Step 2: Main loop. Repeat the following steps while last−ℓ > ε, where is the negative log likelihoodlogp(X|Θ) from the parameter Θ andlast is the negative log likelihood of the last repetition:

Step 2.1: Expectation step. For every edge (xi, xj) of treeT, find the expected value of the number of edges N(a, b|X, Z) having the labels xi = a and xj =b∈∆, that is, to find

A[a][b] = EXΘ[N(a, b|X, Z)|Θ0] (4.2)

= ∑

xXZ:x̸=root

p(π(x)=a, x=b|Z,Θ0), (4.3) for any labels a, b ∆, and find the expected value of the number of root N(a|Z) having the labels x0 =a, that is, to find

R[a] = EXΘ[N(a|Z)|Θ0] (4.4)

= p(x=a|Z,Θ0), (4.5)

for any labelsa∈∆.

Step 2.2: Maximization step. Find the optimal ˆΘ that maximized the likeli- hood p(Z|Θ) ofˆ Z given ˆΘ, that is, to find

Θ = arg maxˆ

Θ p(Z |Θ) (4.6)

= arg max

Θ

X

p(X, Z|Θ). (4.7)

Lemma 9 For any labels a, b∈∆,

EXΘ[N(a, b|X, Z)|Θ0] = ∑

xXZ:x̸=root

p(π(x)=a, x=b|Z,Θ0).

(23)

Proof:

EXΘ[N(a, b|X, Z)|Θ0]

= EXΘ

[ ∑

xXZ:x̸=root

δ(a, b|x, X) ]

(by the definition of N(a, b|X, Z).)

= ∑

xXZ:x̸=root

EXΘ[δ(a, b|x, X)] (by linearity of expectation in Lemma 29.)

= ∑

xXZ:x̸=root

X

p(π(x)=a, x=b|X, Z,Θ0)·δ(a, b|x, X) (by the definition of expectation in Definition 11.)

= ∑

xXZ:x̸=root

X

p(π(x)=a, x=b|X, Z,Θ0) (by the definition ofδ below.)

= ∑

xXZ:x̸=root

p(π(x) = a, x=b|Z,Θ0) (by marginalization over X.), where

δ(a, b|x, X) =





1 π(x)=a, x=b, 0 otherwise.

The concept of EM algorithms was originally introduced by Dempster, Laird, and Ru- bin [4]. The name of the EM algorithm came from the fact that the algorithm alternately executes the expectation step and the maximization step.

4.2 The algorithm EM Tree

Based on the algorithm scheme of the EM algorithm, we show in Fig. 4.1, our algo- rithm EM Tree. This algorithm computes the parameter Θ from a given external label assignmentZ as observed variables on an input phylogenetic treeT by using the EM al- gorithm with latent variables X. In the main loop of EM Tree, firstly, the subprocedures EM BottomUpandEM TopDowncomputem-vectorsP BU[x][·] andT D[x][·][0,1]m for every node x ofT, by traversingT from the leaves to the root and from the root to the leaves respectively. Secondly, the subprocedure EM ExpectedCount computes the edge count table A[·][·] and the root count table R[·]. Finally, the subprocedure EM Estimate updates the values of Θ = (ρ, θ) from these tables A[·][·] and R[·]. The main loop is

(24)

Algorithm EM Tree(∆ = {1, . . . , m}: a label alphabet, T: a phylogenetic tree, Z: a label assignment for leaves of T, Θ0 = (ρ0, θ0): initial parameters, ε: threshold for convergence):

1: (ρ, θ) = (ρ0, θ0);

2: while (ℓlast−ℓ > ε) do

3: last =ℓ;

4: P BU =EM BottomUp(root, ρ, θ);

5: T D=EM TopDown(root, ρ, θ);

6: (R, A) =EM ExpectedCount(P BU, T D, ρ, θ);

7: (ρ, θ, ℓ) = EM Estimate(R, A);

8: end while

9: return Θ = (ρ, θ);

Figure 4.1: The algorithm EM Tree

iterated until the change in log likelihood ℓ(Z) =ℓ(Z |Θ) is less than a given threshold ε >0 or the maximum number of iterations is exceeded.

The EM Tree consists of two steps. The first step called Expectation step (E-step) corresponds to Step 2.1 in the algorithm scheme of EM algorithm and consist of the procedures EM BottomUp, EM TopDown, and EM ExpectedCount. In this step, the pro- cedures together computes the expected value of the number of edges A[a][b] having the labels xi = a and xj = b ∆, and expected value of the number of the root R[a] hav- ing the labels x0 = a. In Fig. 4.1 the procedures solve this problem by using dynamic programming (DP) [3] on an input phylogenetic tree T. We see that the procedure EM BottomUp and EM TopDown in this step are a generalization of the forward algo- rithm and the backward algorithm [5] respectively for HMMs to that for phylogenetic tree. The second step called Maximization step (M-step) corresponds to Step 2.2 in the algorithm scheme of the EM algorithm and consist of the procedure EM Estimate. In this step, the procedure computes the values of Θ = (ρ, θ) that maximized the likelihood p(Z|Θ) of Z given Θ by using ML-estimation.

In the rest of this chapter, we fix the label assignment Z for leaves.

(25)

Procedure EM BottomUp(x: node, (ρ, θ): parameter):

1: if x is leaf then

2: for each label a∈do P BU[x][a] =θag(x);

3: else

4: EM BottomUp(xL, ρ, θ);

5: EM BottomUp(xR, ρ, θ);

6: for each label a∈do P BU[x][a] =

b{P BU[xL][b]·P BU[xR][b]·θab};

7: end if

8: return P BU;

Figure 4.2: The procedure EM BottomUp

4.3 The procedure EM BottomUp

In Fig. 4.2, we show the recursive procedureEM BottomUpfor computing theP BU table by traversing T in a bottom-up manner.

For each node x in T, we define the following tables with respect to the subtree Tx =Xx∪Zx of T rooted atx, where a is any label:

The valueBU[x][a] is defined by the probability BU[x][a] =p(Zx|x=a) =

Xx:x=a

p(Zx, X). (4.8)

The valueP BU[x][a] is defined by the probability P BU[x][a] =p(Zx|π(x)=a) =

Xx

p(Zx, X), (4.9)

where π(x) is the parent of x.

The next lemma says that BU[x][a] and P BU[x][a] are interchangeable each other.

Lemma 10 For every node x, the following equation hold:

BU[x][a] =P BU[xL][a]·P BU[xR][a].

(26)

Proof: By definition, we have BU[x][a] = p(Zx |x = a). Since x has exactly two children xL and xR, we can split Zx asZx =ZxL∪ZxR. Thus, we have p(Zx|x =a) = p(ZxL|x= a)·p(ZxR |x =a). Then, we can show that p(ZxL|x =a) = p(Zy |π(y) = a) = P BU[y][a] = P BU[xL][a], where we put y = xL and π(y) = x. Similarly, we can also show that p(ZxL | x = a) = P BU[xL][a]. Combining the above discussion, BU[x][a] =P BU[xL][a]·P BU[xR][a].

Lemma 11 For every node x, the following equation hold:

P BU[x][a] =∑

b

BU[x][b]·θab. Proof: We show the following.

P BU[x][a]

= p(Zx|π(x) =a) (by the definition ofP BU.)

= ∑

b

p(Zx|x=b)·p(x=b|π(x) =a) (by Lemma 27.)

= ∑

b

BU[x][b]·θab (by the definition of BU[x][a] andθab.).

Now, we give a recurrence formula for computing P BU as follows (Fig. 4.3).

Lemma 12 (recurrence for P BU) For any node x and any labela∈∆, the following hold:

1. If x is a leaf then P BU[x][a] =θag(x). 2. If x is an internal node, then

P BU[x][a]

= ∑

b

{P BU[xL][b]·P BU[xR][b]·θab}.

(27)

Figure 4.3: Computation of the PBU table on the subtreeTX

(28)

Proof: We show the following.

P BU[x][a]

= p(Zx|π(x) =a) (by the definition ofP BU.)

= ∑

b

{p(Zx|x=b)·p(x=b|π(x) =a)} (by Lemma 27.)

= ∑

b

{p(ZxL|x=b)·p(ZxR |x=b)·p(x=b|π(x) =a)} (becauseZx=ZxL∪ZxR.)

= ∑

b

{P BU[xL][b]·P BU[xR][b]·θab} (by the definition of P BU and θab.).

By the above recurrence, we have the following lemma.

Lemma 13 The procedureEM BottomUpin Fig. 4.2 correctly computes the tableP BU[x][a]

for any node x and labela∈for a phylogenetic tree T and the leaf label assignmentZ. Proof: For a node x, the procedure EM BottomUp in Fig. 4.2 computes the table P BU[x][a] correctly for any nodexand any label a at line 2 (if xis a leaf) and line 6 (if xis an internal node) by Lemma 12. Then, since the procedure visits all nodes from leaves to the root from line 4 to line 5, the procedure correctly computes the table P BU[x][a]

for any node xand label a.

Lemma 14 The procedure EM BottomUp in Fig. 4.2 runs in O(m2n) time on T. Proof: In Fig. 4.2, the procedureEM BottomUpcomputes the tableP BU[x][a] for each label a in O(m2) time from line 6 to line 7. Then, the procedure iteratively visits all nodes x and computes the table P BU. Therefore, the procedure EM BottomUp runs in O(m2n) time.

4.4 The procedure EM TopDown

In Fig. 4.4, we show the recursive procedure EM TopDown for computing the T D table by traversing T in a top-down manner.

For each node x in T, we define the following table with respect to the subgraph Tx = T \Tx that is obtained from T = X ∪Z by removing the subtree Tx = Xx∪Zx

(29)

Procedure EM TopDown(x: node, (ρ, θ): parameters):

1: if x is the root x0 then

2: for each label a∈do T D[x][a] =ρa;

3: else

4: for each label a∈do T D[x][a] =

b∈∆{P BU[x][b]·θba·T D[π(x)][b]};

5: end if

6: EM TopDown(xL, ρ, θ);

7: EM TopDown(xR, ρ, θ);

8: return T D;

Figure 4.4: The procedureEM TopDown

rooted at x. See Fig. 4.5 for an example of Tx. Then, for any label a, the value T D[x][a]

is defined by the probability

T D[x][a] =p(Zx, x=a). (4.10) Now, we give a recurrence formula for computing T D as follows (Fig. 4.5).

Lemma 15 (recurrence for T D) For any node x and any a∈∆, the following hold:

1. If x is the root x0 then T D[x0][a] =ρa. 2. If x is an internal node but the root, then

T D[x][a]

= ∑

b

{P BU[x][b]·T D[π(x)][b]·θba},

where x is the sibling of x such that =x.

(30)

Figure 4.5: Computation of the TD table on the anti-subtree Tx

(31)

Proof: We show the following.

T D[x][a] = p(Zx, x=a) (by the definition of TD.)

= ∑

π(x)=b

p(Zx, x=a, π(x) =b) (by marginalization.)

= ∑

π(x)=b

p(Zx, Zπ(x), x=a, π(x) = b) (because Zx =Zx ∪Zπ(x).)

= ∑

π(x)=b

p(Zx, x=a|Zπ(x), π(x) = b)·p(Zπ(x), π(x) = b)

(by the definition of the conditional probability in Definition 4.)

= ∑

π(x)=b

p(Zx, x=a|π(x) =b)·T D[π(x)][b]

(by Markov property and the definition of T D.)

= ∑

π(x)=b

p(Zx |π(x) = b)·p(x=a|π(x) =b)·T D[π(x)][b] (by Markov property.)

= ∑

π(x)=b

P BU[x][b]·T D[π(x)][b]·θba (by the definition ofP BU and θab.).

By the above recurrence, we have the following lemma.

Lemma 16 The procedureEM TopDownin Fig. 4.4 correctly computes the tableT D[x][a]

for any node x and labela∈for a phylogenetic tree T and the leaf label assignmentZ. Proof: In Fig. 4.4, for a nodex, the procedureEM TopDowncomputes the tableT D[x][a]

correctly for any label a at line 2 (if x is a leaf) and line 4 (if x is an internal node) by Lemma 15. Then, since the procedure visits all nodes from the root to leaves from line 6 to line 7, the procedure correctly computes the table T D[x][a] for any node x and label a.

Lemma 17 The procedure EM TopDown in Fig. 4.4 runs in O(m2n) time on T.

Proof: In Fig. 4.4, the procedure EM TopDown computes the table T D[x][a] for each label a in O(m2) time from line 4 to line 5. Then, the procedure iteratively visits all nodes x and computes the table T D. Therefore, the procedure EM TopDown runs in O(m2n) time.

(32)

Procedure EM ExpectedCount((ρ, θ): parameters, P BU, T D):

1: for each label a∈do

2: R[a] =p(x=a|Z).

3: end for

4: for each label a∈do

5: for each label b∈do

6: A[a][b] =

xXZ:x̸=root{p(π(x)=a, x=b|Z)};

7: end for

8: end for

9: return (R, A);

Figure 4.6: The procedure EM ExpectedCount

4.5 The procedure EM ExpectedCount

In Fig. 4.6, we show the procedure EM ExpectedCount for computing the tableA[·][·] and table E[·] which represent the expected value of the number of edge count and the expected value of the number of root count respectively.

First, we give the likelihood of the whole data Z in terms of the tables P BU. Let x0L and x0R be the left and right children of the root x0.

Lemma 18 For an input leaf label assignment Z, we have:

p(Z) =

a

P BU[x0L][a]·P BU[x0R][a]·ρa. (4.11) Proof: SinceZ =Zx0, we havep(Z) =∑

ap(Z|x0=a)·p(x0=a) =

aBU[root][a]·ρa. From Lemma 10, the result follows.

From the above lemma, we have the posterior probability of x=a as follows.

Lemma 19 For any internal nodex, we have the following joint probability, wherea is any label:

p(x=a|Z) = BU[x][a]·T D[x][a]/ p(Z). (4.12)

(33)

Proof: By partitioning the whole treeT intoTx andTx, we havep(Z, x=a) =p(Zx|x=

a)·p(Zx, x=a). Since BU[x][a] =p(Zx|x=a) andT D[x][a] =p(Zx, x=a) by definitions, we have p(Z, x=a) = BU[x][a]·T D[x][a], and thus, the lemma follows.

Finally, we have the edge probability (Fig. 4.7).

Lemma 20 (edge probability) For any internal nodex, we have the conditional prob- ability p(π(x)=a, x=b|Z) as follows:

If x is an internal node, then

p(π(x)=a, x=b|Z)

= θab·T D[π(x)][a]·P BU[x][a]· P BU[xL][b]·P BU[xR][b]/ p(Z).

If x is a leaf, then

p(π(x)=a, x=b|Z)

= θab·T D[π(x)][a]·P BU[x][a]/ p(Z), where a, b∈are any labels.

(34)

Figure 4.7: Explanation of Lemma 20

(35)

Proof: If x is an internal node, then p(π(x)=a, x=b, Z)

= p(π(x)=a, x=b, Zπ(x), Zπ(x)) (because Z=Zπ(x)∪Zπ(x).)

= p(x=b, Zπ(x)|π(x)=a, Zπ(x))·p(π(x)=a, Zπ(x))

(by the definition of the conditional probability in Definition 4.)

= p(x=b, Zπ(x)|π(x)=a, Zπ(x))·T D[π(x)][a] (by the definition of T D.)

= p(x=b, Zπ(x)|π(x)=a)·T D[π(x)][a] (by Markov property.)

= p(x=b, Zx, Zx |π(x)=a)·T D[π(x)][a] (because Zπ(x)=Zx∪Zx.) (4.13)

= p(Zx|x=b, Zx, π(x)=a)·p(x=b, Zx |π(x)=a)·T D[π(x)][a]

(by the definition of the conditional probability in Definition 4.)

= p(Zx|x=b)·p(x=b, Zx|π(x)=a)·T D[π(x)][a] (by Markov property.)

= p(Zx|x=b)·p(Zx |x=b, π(x)=a)·p(x=b|π(x)=a)·T D[π(x)][a]

(by the definition of the conditional probability in Definition 4.)

= p(Zx|x=b)·p(Zx |π(x)=a)·p(x=b|π(x)=a)·T D[π(x)][a] (by Markov property.)

= p(x=b|π(x)=a)·BU[x][a]·P BU[x][a]·T D[π(x)][a] (by the definition ofBU and P BU.)

= θab·P BU[xL][b]·P BU[xR][b]·P BU[x][a]·T D[π(x)][a] (by Lemma 10.).

Therefore, we have

p(π(x)=a, x=b|Z) =θab·P BU[xL][b]·P BU[xR][b]·P BU[x][a]·T D[π(x)][a]/p(Z).

If x is a leaf, in Equation 4.13, Zx =x. Hence, we have

p(π(x)=a, x=b, Z) = p(x=b, x, Zx |π(x)=a)·T D[π(x)][a] (by Equation 4.13.)

= p(x=b, Zx |π(x)=a)·T D[π(x)][a] (by derivation.)

= p(x=b|π(x)=a)·p(Zx|π(x)=a)·T D[π(x)][a] (by Markov property.)

= θab·P BU[x][a]·T D[π(x)][a] (by the definition of P BU and θab.).

Therefore, we have

p(π(x)=a, x=b|Z) =θab·P BU[x][a]·T D[π(x)][a]/p(Z).

(36)

Now, we define an m×m matrix A[·][·], called the expected edge count table and an m-vector R[·], called the expected root count table as follows. For every pairs of labels a, b ∆, we define the value A[a][b] which is defined by the expected number of edges e= (xi, xj) having the labels xi =a and xj =b ∆ by

A[a][b] =

xXZ:x̸=root

p(π(x)=a, x=b|Z). (4.14)

Lemma 21 For any labels a, b∈∆, the edge count table A[a][b] is given by:

A[a][b] =

x:leaf

ab·T D(π(x), a)·P BU[x][b]· P BU[x][a]/ p(Z)}

+ ∑

x:internal

ab·T D[π(x)][a]·P BU[x][a]· P BU[xL][b]·P BU[xR][b]/ p(Z)}. Proof: Immediately from Lemma 20.

For any labels a ∆, we define the value R[a] which is defined by the expected number of the root x0 having the labels x0 =a by

R[a] =p(x=a|Z). (4.15)

Lemma 22 For any labels a∈∆, the root count table R[a] is given by:

R[a] =ρa·P BU[x0L][a]·P BU[x0R][a]/ p(Z). (4.16) Proof: Clearly, p(Z, x0=a) =p(Zx0 |x0=a)·ρa. Since p(Zx0 |x0=a) = BU[x0][a] = P BU[x0L][a]·P BU[x0R][a] from Lemma 10, the result follows.

Lemma 23 The procedure EM ExpectedCount in Fig. 4.6 correctly computes the table R[a] for any label a∈and the table A[a][b] for any label a, b∈∆.

Lemma 24 The procedure EM ExpectedCount in Fig. 4.6 runs in O(m2n) time on T. Proof: From Lemma 21, to compute a table A[a][b], the procedure EM ExpectedCount visits all nodesx∈X∪Z :=root. Therefore, the procedure computes the tableA[a][b]

for any label a, b ∆ in O(m2n) time from line 4 to line 8. As a result, the procedure EM ExpectedCount runs in O(m2n) time.

(37)

Procedure EM Estimate(R, A):

1: For every a, b∈∆, compute θab by:

θab = A[a, b]

b(A[a, b]);

2: For every a∈∆, computeρa by:

ρa = R[a]

a(R[a]);

3: Compute the negative log likelihood ℓ(Z) by:

=ℓ(Z) =logp(Z |ρ, θ);

4: return (ρ, θ, ℓ);

Figure 4.8: The procedureEM Estimate

4.6 The procedure EM Estimate

In Fig. 4.8, we show the procedureEM Estimate for updating the values of Θ = (ρ, θ) that maximized the likelihood p(X, Z |Θ) from these tables R and A by using ML estimation of multinomial distributions.

The procedureEM Estimatein Fig. 4.8 computes the estimation of the root probability ρ, the transmission probability θ, and the negative log likelihood from tables R and A using a given pseudo countα >0.

Lemma 25 The procedure EM Estimate in Fig. 4.8 runs in O(m2) time.

Proof: In Fig. 4.8, the procedure EM Estimate computes the parameter θab for each label a, b∈∆ in O(m2) time at line 1. Therefore, the result follows.

We have the time complexity of the update of parameter Θ = (ρ, θ) by our EM algorithm.

Theorem 26 Each iteration of the while-loop in the algorithmEM Tree of Fig. 4.1 takes O(m2n) time and O(mn) space on T, where m =|| is the size of a label alphabet and n =O(||T ||) is the number of leaves.

(38)

Proof: Since each nodexhas the m-vectorP BU andT D,EM TreetakesO(mn) space.

Then, by Lemma 14, Lemma 17, and Lemma 25, EM Tree takes O(m2n) time.

4.7 Extension with prior distribution

We can extend our probabilistic model for GTP by introducing prior distribution for parameter Θ = (ρ, θ) in Bayesian framework [2] as follows. We model the priors for θ and ρby Dirichlet distributionsDir(· |α0) and Dir(· |β0) with hyper-parametersα0 and β0. Then, the joint probability distribution for X, Z, and Θ is given by:

p(X, Z,Θ0, β0)

= p(Z|X,Θ)p(X|Θ)q(Θ|α0, β0), (4.17) where

q(Θ|α0, β0) = q(θ|α0)q(ρ|β0) (4.18)

θ|α0 Dir(· |α0) (4.19)

ρ|β0 Dir(· |β0). (4.20)

In this case, our problem is the maximum a posteriori estimation (MAP-estimation) of the parameter Θ = (ρ, θ) to find Θ that maximizes a posteriori probability of Θ:

p(Θ|Z, α0, β0)

p(Z,Θ0, β0)

= p(Z|Θ) p(Θ|α0, β0)

logp(Z|Θ) + logp(Θ|α0, β0). (4.21) To find the parameters Θ = (ρ, θ) that maximizes Equation (4.21), we use the MAP solution for multinomial distribution with Dirichlet prior ([7]). For this purpose, we modify the procedure EM Estimate of Fig. 4.8 by replacing the code from line 3 to line 4 with the code in Fig. 4.9 using a pseudo count α as a hyper-parameter.

In the modified EM algorithm, the Expectation step is identical as the original version of EM Tree. In the Maximization step, the above code tries to maximize

EΘ[logp(Θ|Z, X)|Z] (4.22)

EΘ[logp(Z, X|Θ)|Z] + logp(Θ|α0, β0),

Figure 1.1: A map with the geographic transmission probability (GTP) of H3N2 in- in-fluenza virus.
Figure 1.2: An example of a phylogenetic tree T (left) and an GTP table θ (right) on an alphabet ∆ = { A, B } of locations.
Figure 3.4: The procedure VT Estimate
Figure 4.3: Computation of the PBU table on the subtree T X
+7

参照

関連したドキュメント

Algorithm 2 takes as input any directive bi-sequence of length n for a two-letter alphabet, normalized or not, and computes, in linear time with respect to the length of the

In order to improve the coordination of signal setting with traffic assignment, this paper created a traffic control algorithm considering traffic assignment; meanwhile, the link

(In a forthcoming paper [2], a further generalization of the conjecture will be given.) We will prove that a weak congruence holds for any cyclic l- extension (Theorem 3.3),

The edges terminating in a correspond to the generators, i.e., the south-west cor- ners of the respective Ferrers diagram, whereas the edges originating in a correspond to the

Furthermore, computing the energy efficiency of all servers by the proposed algorithm and Hadoop MapReduce scheduling according to the objective function in our model, we will get

Comparing the Gauss-Jordan-based algorithm and the algorithm presented in [5], which is based on the LU factorization of the Laplacian matrix, we note that despite the fact that

In this research, the ACS algorithm is chosen as the metaheuristic method for solving the train scheduling problem.... Ant algorithms and

If in the infinite dimensional case we have a family of holomorphic mappings which satisfies in some sense an approximate semigroup property (see Definition 1), and converges to