Inference with Constrained Hidden Markov Models in PRISM

801 views
719 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
801
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
23
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Inference with Constrained Hidden Markov Models in PRISM

  1. 1. Inference with Constrained Hidden Markov Models in PRISM Henning Christiansen Christian Theil Have Ole Torp Lassen Matthieu Petit Research group PLIS: Programming, Logic and Intelligent Systems Department of Communication, Business and Information Technologies Roskilde University, P.O.Box 260, DK-4000 Roskilde, Denmark ICLP 2010 in Edinburgh, July 16, 2010Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  2. 2. Outline1 Motivation and background Hidden Markov Models Biological sequence alignment with pair HMMs2 Constrained HMMs CHMMs as a constraint program Decoding algorithm for CHMMs Implementation in PRISM3 Summary and future directions Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  3. 3. Motivation and backgroundMotivation In the LoSt project we explore the use of Probabilistic Logic programming (with PRISM) for biological sequence analysis Hidden Markov Models are one of the most widely used models for sequence analysis Constrained Hidden Markov Models (CHMMs) allow us to express relevant prior knowledge and prune the search space Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  4. 4. Motivation and backgroundContributions and similar workContributions Expressing CHMMs as a constraint problem Adaptation of Viterbi decoding algorithm for CHMMs Efficient implementation of CHMMs in PRISMSimilar work In [SK08] introduces the concept of CHMMs [CPC08] express relationships in Bayesian Network as a CLP Constrained Conditional Models [CRR08] augments (discriminative) models with declarative constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  5. 5. Motivation and background Hidden Markov ModelsHidden Markov ModelsDefinitionA Hidden Markov Model (HMM) is a 4-tuple S, A, T , E , where S = {s0 , s1 , . . . , sm } is a set of states which includes an initial state referred to as s0 ; A = {e1 , e2 , . . . , ek } is a finite set of emission symbols; T = {(p(s0 ; s1 ), . . . , p(s0 ; sm )), . . . , (p(sm ; s1 ), . . . , p(sm ; sm ))} is a set of transition probability distributions representing probabilities to transit from one state to another; E = {(p(s1 ; e1 ), . . . , p(s1 ; ek )), . . . , (p(sm ; e1 ), . . . , p(sm ; ek ))} is a set of emission probability distributions representing probabilities to emit each symbol from one state. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  6. 6. Motivation and background Hidden Markov ModelsHidden Markov Model, graphical example Postcard Greetings from wherever, where I am having a great time. Here is what I have been doing: The first two days, I stayed at the hotel reading a good book. Then, on the third day I decided to go shopping. The next three days I did nothing but lie on the beach. On my last day, I went shopping for some gifts to bring home and wrote you this postcard. Sincerely, Some friend of yours Observation sequence Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  7. 7. Motivation and background Hidden Markov ModelsHidden Markov Model runDefinitionA run of an HMM as a pair consisting of a sequence of statess (0) s (1) . . . s (n) , called a path and a corresponding sequence of emissionse (1) . . . e (n) , called an observation, such that s (0) = s0 ; ∀i, 0 ≤ i ≤ n − 1, p(s (i) ; s (i+1) ) > 0 (probability to transit from s (i) to s (i+1) ); ∀i, 0 < i ≤ n, p(s (i) ; e (i) ) > 0 (probability to emit e (i) from s (i) ).DefinitionThe probability of such a run is defined as i=1..n p(s (i−1) ; s (i) ) · p(s (i) ; e (i) ) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  8. 8. Motivation and background Hidden Markov ModelsDecoding with Hidden Markov ModelsDecoding: Inferring the hidden path given the observation sequence. argmaxpath P(path|observation)Computed in linear time using dynamic programming:The Viterbi algorithm can be seen as keeping track of, for each prefix ofan observed emission sequence, the most probable (partial) path leading toeach possible state, and extending those step by step into longer paths,eventually covering the entire emission sequence. source: wikipedia Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  9. 9. Motivation and background Biological sequence alignment with pair HMMsA tiny bit of biological motivation Biologists often want to align sequences (e.g. DNA, proteins, etc.) which are thought to have descended from a common ancestor Sequence alignment is fundamental to bioinformatics We (computer scientists) can just consider biological sequences as a list of symbols The number of possible of alignments is exponential An optimal alignment can be found using a Pair HMM in O(|sequence|2 ∗ |states|2 ) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  10. 10. Motivation and background Biological sequence alignment with pair HMMsPair HMMs for sequence alignment A pair HMM is a special kind of HMM that emits two sequences Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  11. 11. Motivation and background Biological sequence alignment with pair HMMsPair HMMs for sequence alignment A pair HMM is a special kind of HMM that emits two sequences The match state emit a pair (xi yj ) of symbols Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  12. 12. Motivation and background Biological sequence alignment with pair HMMsPair HMMs for sequence alignment A pair HMM is a special kind of HMM that emits two sequences The match state emit a pair (xi yj ) of symbols The insert state emits one symbol xi , from sequence x Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  13. 13. Motivation and background Biological sequence alignment with pair HMMsPair HMMs for sequence alignment A pair HMM is a special kind of HMM that emits two sequences The match state emit a pair (xi yj ) of symbols The insert state emits one symbol xi , from sequence x The delete state emits one symbol yj , from sequence y Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  14. 14. Motivation and background Biological sequence alignment with pair HMMsPair HMMs for sequence alignment A pair HMM is a special kind of HMM that emits two sequences The match state emit a pair (xi yj ) of symbols The insert state emits one symbol xi , from sequence x The delete state emits one symbol yj , from sequence y A run of this model produces an alignment of x and y Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  15. 15. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x sequence y alignment b Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  16. 16. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H sequence y alignment b i Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  17. 17. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G sequence y alignment b i i Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  18. 18. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K sequence y alignment b i i i Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  19. 19. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K sequence y K alignment b i i i m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  20. 20. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G sequence y K G alignment b i i i m m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  21. 21. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A sequence y K G P alignment b i i i m m m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  22. 22. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A sequence y K G P K alignment b i i i m m m d Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  23. 23. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A sequence y K G P K K alignment b i i i m m m d d Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  24. 24. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A A sequence y K G P K K A alignment b i i i m m m d d m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  25. 25. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A A Q sequence y K G P K K A Q alignment b i i i m m m d d m m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  26. 26. Motivation and background Biological sequence alignment with pair HMMsAlignment with a pair Hidden Markov ModelObservation sequence x Observation sequence yH G K K G A A Q V K G P K K A Q A sequence x H G K K G A A Q V sequence y K G P K K A Q A alignment b i i i m m m d d m m m Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  27. 27. Constrained HMMs1 Motivation and background Hidden Markov Models Biological sequence alignment with pair HMMs2 Constrained HMMs CHMMs as a constraint program Decoding algorithm for CHMMs Implementation in PRISM3 Summary and future directions Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  28. 28. Constrained HMMsConstrained HMMsDefinitionA constrained HMM (CHMM) is a 5-tuple S, A, T , E , C where, S, A, T , E is an HMM C is a set of constraints, each of which is a mapping from HMM runs into {true, false}.A run of a CHMM, path, observation is a run of the corresponding HMMfor which C (path, observation) is true. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  29. 29. Constrained HMMsConstrained HMMsWhy extend an HMM with side-constraints? To create better, more specific models with fewer states Convenient to express prior knowledge in terms of constraints No need to change underlying HMM Sometimes it is not possible or feasible to express such constraints as HMM structure (e.g. all different) → infeasibly huge state and parameter space fewer paths to consider for any given sequence → decreased running time Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  30. 30. Constrained HMMs CHMMs as a constraint programRuns of a CHMM as a constraint programWe consider runs of CHMM as a constraint program over finite domains.A run of CHMM is a solution of the constraint program run([s (0) , S1 , . . . , Sn ], [E1 , . . . , En ]), dom(Si ) = S {s0 } ∧ dom(Ei ) = E The variable Si represents the HMM state at step i The variable Ei represents the emission at the step i Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  31. 31. Constrained HMMs CHMMs as a constraint programDefinition of the HMM run programThe run predicate is specified as follows,run([s (0) , S1 , . . . , Sn ], [E1 , . . . , En ]) is true iff∃s (1) ∈ dom(S1 ), . . . , ∃s (n) ∈ dom(Sn )∧∃e (1) ∈ dom(E1 ), . . . , ∃e (n) ∈ dom(En )∧C (s (0) s (1) . . . s (n) , e (1) . . . e (n) ) is true, s (0) = s0 ∧p(s (0) ; s (1) ) · p(s (1) ; e (1) ) . . . p(s (n−1) ; s (n) ) · p(s (n) ; e (n) ) > 0.This states thats (0) s (1) . . . s (n) and e (1) . . . e (n) is a HMM run which satisfies C . Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  32. 32. Constrained HMMs CHMMs as a constraint programThe HMM structure The last line in the definition, p(s (0) ; s (1) ) · p(s (1) ; e (1) ) . . . p(s (n−1) ; s (n) ) · p(s (n) ; e (n) ) > 0 indicates the (local) relationships between Si ,Si+1 and Si ,Ei which correspond to the structure of the HMM. We define these relationships in terms of constraints, trans(Si−1 , Si ) ∧ emit(Si , Ei ), for all i, 1 ≤ i ≤ ntrans(Si , Si+1 ) is true iff emit(Si , Ei ) is true iff∃s (i) ∈ dom(Si ) ∧ s (i+1) ∈ dom(Si+1 ) ∃s (i) ∈ dom(Si ) ∧ e (i) ∈ dom(Ei )such that p(s (i) ; s (i+1) ) > 0 such that p(s (i) ; e (i) ) > 0 Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  33. 33. Constrained HMMs CHMMs as a constraint programRevisiting the pair HMMConsider adding constraints to the pair HMM introduced earlier.For instance..In a biological context, we may want to onlyconsider alignments with a limited number ofinsertions and deletions given the assumptionthat the two sequences are closely related. C= {cardinality atmost(Nd , [S1 , . . . , Sn ], delete), cardinality atmost(Ni , [S1 , . . . , Sn ], insert)} .The constraint cardinality atmost(N, L, X ) is satisfied whenever L is a listof elements, out of which at most N are equal to X . Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  34. 34. Constrained HMMs CHMMs as a constraint programComputation of best alignment with constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  35. 35. Constrained HMMs Decoding algorithm for CHMMsDecoding with a CHMMDecoding is the process of finding the most probable state sequence givena known sequence of observations.Consider a given observation e (1) . . . e (n) , a CHMM S, A, T , E , C , and itsconstraint program run([s (0) , S1 , . . . , Sn ], [e (1) , . . . , e (n) ]).The most probable path is computed by finding the valuation s (1) , . . . , s (n)that maximizes the objective function: the run probability.In standard HMMs this is usually accomplished in polynomial time usingthe Viterbi dynamic programming algorithm.But we need to consider additional constraints, C . Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  36. 36. Constrained HMMs Decoding algorithm for CHMMsAn algorithm for decoding with CHMMsThe computation starts from an initial set of 5-tuples{ s (0) , 0, 1, , C ∧ trans(s (0) , S1 ) ∧ 1≤i≤n−1 trans(Si , Si+1 ) ∧ 1≤i≤n emit(Si , ei ) }. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  37. 37. Constrained HMMs Decoding algorithm for CHMMsAn algorithm for decoding with CHMMsThe computation starts from an initial set of 5-tuples{ s (0) , 0, 1, , C ∧ trans(s (0) , S1 ) ∧ 1≤i≤n−1 trans(Si , Si+1 ) ∧ 1≤i≤n emit(Si , ei ) }.Then, the following two rules are applied as long as possible Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  38. 38. Constrained HMMs Decoding algorithm for CHMMsAn algorithm for decoding with CHMMsThe computation starts from an initial set of 5-tuples{ s (0) , 0, 1, , C ∧ trans(s (0) , S1 ) ∧ 1≤i≤n−1 trans(Si , Si+1 ) ∧ 1≤i≤n emit(Si , ei ) }.Then, the following two rules are applied as long as possibletrans ctrΣ := Σ ∪ { s , i +1, p · p(s; s ) · p(s ; e (i+1) ), π s , σ ∧ Si+1 = s }whenever s, i, p, π, σ ∈ Σ, p(s; s ), p(s ; e (i+1) ) > 0 andcheck constraints(σ ∧ Si+1 = s ) and prune ctr does not apply. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  39. 39. Constrained HMMs Decoding algorithm for CHMMsAn algorithm for decoding with CHMMsThe computation starts from an initial set of 5-tuples{ s (0) , 0, 1, , C ∧ trans(s (0) , S1 ) ∧ 1≤i≤n−1 trans(Si , Si+1 ) ∧ 1≤i≤n emit(Si , ei ) }.Then, the following two rules are applied as long as possibletrans ctrΣ := Σ ∪ { s , i +1, p · p(s; s ) · p(s ; e (i+1) ), π s , σ ∧ Si+1 = s }whenever s, i, p, π, σ ∈ Σ, p(s; s ), p(s ; e (i+1) ) > 0 andcheck constraints(σ ∧ Si+1 = s ) and prune ctr does not apply.prune ctrΣ := Σ { s, i +1, p , π , σ }whenever there is another s, i +1, p, π, σ ∈ Σ withp ≥ p and sol(σ ) ⊆ sol(σ) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  40. 40. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  41. 41. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → OK Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  42. 42. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  43. 43. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  44. 44. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → OK Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  45. 45. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  46. 46. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  47. 47. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → OK Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  48. 48. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  49. 49. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  50. 50. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → OK Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  51. 51. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  52. 52. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  53. 53. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → fail Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  54. 54. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path not extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  55. 55. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  56. 56. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → OK Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  57. 57. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  58. 58. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  59. 59. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)check constraints → fail Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  60. 60. Constrained HMMs Decoding algorithm for CHMMsIllustration of the trans ctr transition ruleConstraints:cardinality atmost(1, [S1 , . . . , Sn ], delete)cardinality atmost(1, [S1 , . . . , Sn ], insert)Path not extended Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  61. 61. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  62. 62. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  63. 63. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  64. 64. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  65. 65. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  66. 66. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Is P(p) ≥ P(p )? Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  67. 67. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Is P(p) ≥ P(p )? yes Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  68. 68. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Is P(p) ≥ P(p )? yes → discard lowest probability path p Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  69. 69. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Is P(p) ≥ P(p )? yes → discard lowest probability path p no → Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  70. 70. Constrained HMMs Decoding algorithm for CHMMsIllustration of the prune ctr rule Two (partial) paths, p and p , reach the same state at time i sol(σ ) ⊆ sol(σ): Are all states reachable from p at any time j > i also reachable from p? no → rule not does apply (keep both paths) yes → Is P(p) ≥ P(p )? yes → discard lowest probability path p no → rule does not apply (keep both paths) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  71. 71. Constrained HMMs Implementation in PRISMPRISM PRogramming In Statistical Modelling developed by Sato, Kameya and Zhou An extension of Prolog with random variables, called MSWs Provides efficient generalized inference algorithms (Viterbi, EM, etc) using tabling Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  72. 72. Constrained HMMs Implementation in PRISMExample HMM in PRISMvalues/2 Example HMM in PRISMdeclares the outcomes values(trans(_), [sunny,rainy]).of random variables values(emit(_), [shop,beach,read]).msw/2 hmm(L):- run_length(T),hmm(T,start,L).simulates a randomvariable, stochastically hmm(0,_,[]).selecting one of the hmm(T,State,[Emit|EmitRest]) :-outcomes T > 0, msw(trans(State),NextState),Model in Prolog msw(emit(NextState),Emit),Specifies relation T1 is T-1,between variables hmm(T1,NextState,EmitRest). run_length(7). Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  73. 73. Constrained HMMs Implementation in PRISMExample HMM in PRISMvalues/2 Example HMM in PRISMdeclares the outcomes values(trans(_), [sunny,rainy]).of random variables values(emit(_), [shop,beach,read]).msw/2 hmm(L):- run_length(T),hmm(T,start,L).simulates a randomvariable, stochastically hmm(0,_,[]).selecting one of the hmm(T,State,[Emit|EmitRest]) :-outcomes T > 0, msw(trans(State),NextState),Model in Prolog msw(emit(NextState),Emit),Specifies relation T1 is T-1,between variables hmm(T1,NextState,EmitRest). run_length(7). Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  74. 74. Constrained HMMs Implementation in PRISMExample HMM in PRISMvalues/2 Example HMM in PRISMdeclares the outcomes values(trans(_), [sunny,rainy]).of random variables values(emit(_), [shop,beach,read]).msw/2 hmm(L):- run_length(T),hmm(T,start,L).simulates a randomvariable, stochastically hmm(0,_,[]).selecting one of the hmm(T,State,[Emit|EmitRest]) :-outcomes T > 0, msw(trans(State),NextState),Model in Prolog msw(emit(NextState),Emit),Specifies relation T1 is T-1,between variables hmm(T1,NextState,EmitRest). run_length(7). Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  75. 75. Constrained HMMs Implementation in PRISMAdding constraint checking to the HMMHMM with constraint checkinghmm(T,State,[Emit|EmitRest],StoreIn) :- T > 0, msw(trans(State),NxtState), msw(emit(NxtState),Emit), check_constraints([NxtState,Emit],StoreIn,StoreOut), T1 is T-1, hmm(T1,NxtState,EmitRest,StoreOut). Call to check constraints/3 after each distinct sequence of msw applications Side-constaints: The constraints are assumed to be declared elsewhere and not interleaved with model specification Extra Store argument in the probabilistic predicate Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  76. 76. Constrained HMMs Implementation in PRISMChecking the constraintsThe goal check constraints/3 calls constraint checkers for allconstraints declared on the model.For instance, with our example pair HMM constraint, C= {cardinality atmost(Nd , [S1 , . . . , Sn ], delete), cardinality atmost(Ni , [S1 , . . . , Sn ], insert)} .We have the following incremental constraint checker implementationA cardinality atmost constraint checkerinit_constraint_store(cardinality_atmost(_,_), 0).check_sat(cardinality_atmost(U,Max), U, In, Out) :- Out is In + 1,Out =< Max.check_sat(cardinality_atmost(X,_),U,S,S) :- X = U. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  77. 77. Constrained HMMs Implementation in PRISMA library of global constraints for Hidden Markov ModelsOur implementation contains a few well-known global constraints adaptedto Hidden Markov Models.Global constraints cardinality lock to sequence all different lock to setIn addition, the implementation provides operators which may be used toapply constraints to a limited set of variables.Constraint operators state specific emission specific forall subseq (sliding window operator) for range (time step range operator) Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  78. 78. Constrained HMMs Implementation in PRISMImproving tabling with PRISMProblem: The extra Store argument makes PRISM table multiple goals(for different constraint stores) when it should only store one.hmm(T,State,[Emit|EmitRest],Store)To get rid of the extra argument, check constraints dynamicallymaintains it as a stack using assert/retract:check_constraints(Update) :- get_store(StoreBefore), check_constraints(Update,StoreBefore,StoreAfter), forward_store(StoreAfter).get_store(S) :- store(S), !.forward_store(S) :- asserta(store(S)) ; retract(store(S)),fail. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  79. 79. Constrained HMMs Implementation in PRISMImpact of using a separate constraint store stack Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  80. 80. Summary and future directions1 Motivation and background Hidden Markov Models Biological sequence alignment with pair HMMs2 Constrained HMMs CHMMs as a constraint program Decoding algorithm for CHMMs Implementation in PRISM3 Summary and future directions Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  81. 81. Summary and future directionsSummaryWe have demonstrated That CHMMs can be a useful tool to Incorporate prior knowledge in probabilistic model Prune the search space and allow faster decoding That CHMMs may be useful in biological sequence analysis How CHMMs can be formulated as a constraint problem An adaptation of the Viterbi algorithm for CHMMs How CHMMs can be efficiently implemented in PRISM Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  82. 82. Summary and future directionsFuture directions Improve method to employ existing state-of-the-art CSP techniques Soft constraints Parameter learning for CHMMs Grammar constraints More biological applications Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  83. 83. Summary and future directionsQuestions Questions? Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM
  84. 84. Summary and future directionsBibliography I V.S. Costa, D. Page, and J. Cussens. CLP(BN): Constraint logic programming for probabilistic knowledge. Probabilistic Inductive Logic Programming, LNAI 4911:156–188, 2008. M-W Chang, L-A Ratinov, and D. Rizzolo, N. Roth. Learning and inference with constraints. In Proc. of AAAI Conference on Artificial Intelligence, pages 1513–1518, Chicago, USA, July 2008. T. Sato and Y. Kameya. New advances in logic-based probabilistic by PRISM. In Probabilistic Inductive Logic Programming, LNCS, pages 118–155. Springer, 2008. Henning Christiansen, Christian Theil Have, Ole Torp Lassen, Matthieu Petit Inference with CHMMs in PRISM

×