SlideShare a Scribd company logo
1 of 13
Hidden Markov
Model
Nghia Bui
Nov 2016
Andrei Markov (1856-1922)
The weather problem
• I talked to Jane for 𝐿 days through telephone.
Everyday she told me what she does, either
“walk” or “shop” or “clean”, only one!
• I know, on a day, the weather in her city can
be either “sunny” or “rainy”, only one!
• But she didn’t tell me exactly the weather on
the 𝐿 days, and how it affected her actions.
• Then I have to figure out by myself!  HMM
2
HMM is just a set of 3 rules
• If today weather is 𝑺𝒊
then tmrw it will be 𝑺𝒋
with probability 𝒂𝒊𝒋
• When weather is 𝑺𝒊
Jane will do action 𝑶 𝒌
with probability 𝒃𝒊(𝒌)
• In the 1st day, the
weather is 𝑺𝒊 with
probability 𝝅𝒊
3
https://en.wikipedia.org/wiki/Hidden_Markov_model
What are hidden?
• The states of weather 𝑆𝑖(𝑖 = 1 … 𝑁) {“sunny”,
“rainy”} are not observable  they are hidden
• The actions 𝑂 𝑘(𝑘 = 1 … 𝑀) {“walk”, “shop”,
“clean”} are observed in an index sequence
𝑜ℎ ℎ = 1 … 𝐿 where 𝑜ℎ = 𝑘 1 ≤ 𝑘 ≤ 𝑀
4
Two common tasks
1. Given a model 𝜆(𝑎, 𝑏, 𝜋) and a sequence of
action indexes 𝑜 = 𝑜1, 𝑜2 … 𝑜 𝐿 please
calculate the probability 𝑃(𝑜|𝜆) the model
generates the sequence.
 The forward algorithm
2. Given a sequence 𝑜, build a model 𝜆 so that
𝑃(𝑜|𝜆) is maximum.
 The Baum-Welch algorithm
5
The forward algorithm
• Let 𝛼𝑖 ℎ be the probability of generating the
sequence 𝑜1 … 𝑜ℎ(ℎ = 1 … 𝐿) and ending up
at state 𝑆𝑖
• Using dynamic programming we have:
 𝛼𝑖 ℎ = 𝑗=1
𝑁
𝛼𝑗 ℎ − 1 𝑎𝑗𝑖 𝑏𝑖(𝑜ℎ)
 𝛼𝑖 1 = 𝜋𝑖 𝑏𝑖(𝑜1)
• And result: 𝑃 𝑜 𝜆 = 𝑖=1
𝑁
𝛼𝑖(𝐿)
6
The Baum-Welch algorithm
• Given a model 𝜆 𝑎, 𝑏, 𝜋 , we use it to generate many
sequences, but consider only the ones that emit
𝑜1, 𝑜2 … 𝑜 𝐿:
Main idea: init with a random model
and make it better incrementally
𝑆1 𝑆2 … 𝑆2 𝑆1
𝑆2 𝑆2 … 𝑆1 𝑆1
… … … … …
𝑆1 𝑆1 … 𝑆1 𝑆2
𝑜1 𝑜2 … 𝑜 𝐿−1 𝑜 𝐿
• Nothing is hidden in these sequences! Now we simply
base on them to estimate 𝑎′, 𝑏′, 𝜋′
7
Estimate 𝑎′, 𝑏′, 𝜋′
• To estimate 𝑎′𝑖𝑗, count the transitions from 𝑆𝑖 to
𝑆𝑗 and to other states
• To estimate 𝑏′
𝑖(𝑘), count the appearances of 𝑆𝑖
that have action index 𝑜ℎ = 𝑘, also count all the
appearances of 𝑆𝑖
• To estimate 𝜋′𝑖, count the appearances of 𝑆𝑖 at
the first element of all sequences, and count the
number of all sequences too
• But, to count all of things above, we need …
8
Forward and backward variables
• Using the forward algorithm we have 𝛼𝑖 ℎ
• Using the backward algorithm we have 𝛽𝑖 ℎ
the probability of generating the sequence
𝑜ℎ+1 … 𝑜 𝐿(ℎ = 1 … 𝐿) starting from tmrw,
given the state 𝑆𝑖 of today. Dynamic
programming is used again:
 𝛽𝑖 ℎ = 𝑗=1
𝑁
𝑎𝑖𝑗 𝑏𝑗(𝑜ℎ+1)𝛽𝑗 ℎ + 1
 𝛽𝑖 𝐿 = 1
9
Estimate 𝑎′
• Count transitions from 𝑆𝑖 to 𝑆𝑗:
𝜉𝑖𝑗 =
ℎ=1
𝐿−1
𝛼𝑖(ℎ)𝑎𝑖𝑗 𝑏𝑗(𝑜ℎ+1)𝛽𝑗(ℎ + 1)
• Thus:
𝑎′𝑖𝑗 =
𝜉𝑖𝑗
𝑘=1
𝑁
𝜉𝑖𝑘
10
Estimate 𝑏′
• Count the appearances of state 𝑆𝑖:
ℎ=1
𝐿
𝛼𝑖 ℎ 𝛽𝑖 ℎ
• Thus:
𝑏′
𝑖 𝑘 =
ℎ=1,𝑜ℎ=𝑘
𝐿
𝛼𝑖 ℎ 𝛽𝑖 ℎ
ℎ=1
𝐿
𝛼𝑖 ℎ 𝛽𝑖 ℎ
11
Estimate 𝜋′
• Count the appearances of 𝑆𝑖 at the first element:
𝛼𝑖 1 𝛽𝑖 1
• Count the number of all sequences:
𝑃 𝑜 𝜆 =
𝑖=1
𝑁
𝛼𝑖 𝐿
• Thus:
𝜋′𝑖 =
𝛼𝑖 1 𝛽𝑖 1
𝑃 𝑜 𝜆
12
Thank you!
• Contact: katatunix@gmail.com
13

More Related Content

What's hot

Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof) jani parth
 
Module9 the pearson correlation
Module9 the pearson correlationModule9 the pearson correlation
Module9 the pearson correlationREYEMMANUELILUMBA
 
7th math c2 -l50--feb26
7th math c2 -l50--feb267th math c2 -l50--feb26
7th math c2 -l50--feb26jdurst65
 
Activity selection problem
Activity selection problemActivity selection problem
Activity selection problemSumita Das
 
Activity selection problem class 12
Activity selection problem class 12Activity selection problem class 12
Activity selection problem class 12Kumar
 
Determining limit functions
Determining limit functionsDetermining limit functions
Determining limit functionsWallie Geollegue
 
Ch 5-integration-part-1
Ch 5-integration-part-1Ch 5-integration-part-1
Ch 5-integration-part-1GpmMaths
 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingnikshaikh786
 
A1 1 linear fxns
A1 1 linear fxnsA1 1 linear fxns
A1 1 linear fxnsvhiggins1
 
Normal Distributions
Normal DistributionsNormal Distributions
Normal Distributionspwheeles
 
Option on two correlated assets
Option on two correlated assetsOption on two correlated assets
Option on two correlated assetsYasha Singh
 
Root locus & nyquist stability criterion
Root locus  & nyquist stability criterionRoot locus  & nyquist stability criterion
Root locus & nyquist stability criterionSatheeshCS2
 

What's hot (17)

Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
 
Density matrices
Density matricesDensity matrices
Density matrices
 
Module9 the pearson correlation
Module9 the pearson correlationModule9 the pearson correlation
Module9 the pearson correlation
 
Variable aleatoria integrable
Variable aleatoria integrableVariable aleatoria integrable
Variable aleatoria integrable
 
7th math c2 -l50--feb26
7th math c2 -l50--feb267th math c2 -l50--feb26
7th math c2 -l50--feb26
 
Activity selection problem
Activity selection problemActivity selection problem
Activity selection problem
 
Activity selection problem
Activity selection problemActivity selection problem
Activity selection problem
 
Activity selection problem class 12
Activity selection problem class 12Activity selection problem class 12
Activity selection problem class 12
 
Determining limit functions
Determining limit functionsDetermining limit functions
Determining limit functions
 
Ch 5-integration-part-1
Ch 5-integration-part-1Ch 5-integration-part-1
Ch 5-integration-part-1
 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sorting
 
A1 1 linear fxns
A1 1 linear fxnsA1 1 linear fxns
A1 1 linear fxns
 
Normal Distributions
Normal DistributionsNormal Distributions
Normal Distributions
 
Option on two correlated assets
Option on two correlated assetsOption on two correlated assets
Option on two correlated assets
 
Root locus & nyquist stability criterion
Root locus  & nyquist stability criterionRoot locus  & nyquist stability criterion
Root locus & nyquist stability criterion
 
Chapter I
Chapter IChapter I
Chapter I
 
First st203
First st203First st203
First st203
 

Similar to Hidden Markov Model

Probabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and SequencesProbabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and SequencesZitao Liu
 
Kalman filter for Beginners
Kalman filter for BeginnersKalman filter for Beginners
Kalman filter for Beginnerswinfred lu
 
Orbital_Simulation (2).pptx
Orbital_Simulation (2).pptxOrbital_Simulation (2).pptx
Orbital_Simulation (2).pptxMSPrasad7
 
programming project
programming projectprogramming project
programming projectLingwen He
 
Solving Poisson Equation using Conjugate Gradient Method and its implementation
Solving Poisson Equation using Conjugate Gradient Methodand its implementationSolving Poisson Equation using Conjugate Gradient Methodand its implementation
Solving Poisson Equation using Conjugate Gradient Method and its implementationJongsu "Liam" Kim
 
Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Adrian Aley
 
Intro to Quant Trading Strategies (Lecture 6 of 10)
Intro to Quant Trading Strategies (Lecture 6 of 10)Intro to Quant Trading Strategies (Lecture 6 of 10)
Intro to Quant Trading Strategies (Lecture 6 of 10)Adrian Aley
 
Reinforcement Learning basics part1
Reinforcement Learning basics part1Reinforcement Learning basics part1
Reinforcement Learning basics part1Euijin Jeong
 
Homework 1 Solution.pptx
Homework 1 Solution.pptxHomework 1 Solution.pptx
Homework 1 Solution.pptxiksanbukhori
 
Stochastic optimal control & rl
Stochastic optimal control & rlStochastic optimal control & rl
Stochastic optimal control & rlChoiJinwon3
 
Learning group em - 20171025 - copy
Learning group   em - 20171025 - copyLearning group   em - 20171025 - copy
Learning group em - 20171025 - copyShuai Zhang
 
Lecture 5 backpropagation
Lecture 5 backpropagationLecture 5 backpropagation
Lecture 5 backpropagationParveenMalik18
 
Statistical analysis for recurrent events data with multiple competing risks
Statistical analysis for recurrent events data with multiple competing risksStatistical analysis for recurrent events data with multiple competing risks
Statistical analysis for recurrent events data with multiple competing risks佳蓉 倪
 
Lesson 9 transcendental functions
Lesson 9 transcendental functionsLesson 9 transcendental functions
Lesson 9 transcendental functionsLawrence De Vera
 
2Multi_armed_bandits.pptx
2Multi_armed_bandits.pptx2Multi_armed_bandits.pptx
2Multi_armed_bandits.pptxZhiwuGuo1
 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notesUmeshJagga1
 
Koh_Liang_ICML2017
Koh_Liang_ICML2017Koh_Liang_ICML2017
Koh_Liang_ICML2017Masa Kato
 

Similar to Hidden Markov Model (20)

Probabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and SequencesProbabilistic Models of Time Series and Sequences
Probabilistic Models of Time Series and Sequences
 
Kalman filter for Beginners
Kalman filter for BeginnersKalman filter for Beginners
Kalman filter for Beginners
 
Orbital_Simulation (2).pptx
Orbital_Simulation (2).pptxOrbital_Simulation (2).pptx
Orbital_Simulation (2).pptx
 
programming project
programming projectprogramming project
programming project
 
Solving Poisson Equation using Conjugate Gradient Method and its implementation
Solving Poisson Equation using Conjugate Gradient Methodand its implementationSolving Poisson Equation using Conjugate Gradient Methodand its implementation
Solving Poisson Equation using Conjugate Gradient Method and its implementation
 
Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)Intro to Quant Trading Strategies (Lecture 2 of 10)
Intro to Quant Trading Strategies (Lecture 2 of 10)
 
Intro to Quant Trading Strategies (Lecture 6 of 10)
Intro to Quant Trading Strategies (Lecture 6 of 10)Intro to Quant Trading Strategies (Lecture 6 of 10)
Intro to Quant Trading Strategies (Lecture 6 of 10)
 
Reinforcement Learning basics part1
Reinforcement Learning basics part1Reinforcement Learning basics part1
Reinforcement Learning basics part1
 
ERF Training Workshop Panel Data 5
ERF Training WorkshopPanel Data 5ERF Training WorkshopPanel Data 5
ERF Training Workshop Panel Data 5
 
Restricted boltzmann machine
Restricted boltzmann machineRestricted boltzmann machine
Restricted boltzmann machine
 
Homework 1 Solution.pptx
Homework 1 Solution.pptxHomework 1 Solution.pptx
Homework 1 Solution.pptx
 
Stochastic optimal control & rl
Stochastic optimal control & rlStochastic optimal control & rl
Stochastic optimal control & rl
 
Av 738- Adaptive Filtering - Background Material
Av 738- Adaptive Filtering - Background MaterialAv 738- Adaptive Filtering - Background Material
Av 738- Adaptive Filtering - Background Material
 
Learning group em - 20171025 - copy
Learning group   em - 20171025 - copyLearning group   em - 20171025 - copy
Learning group em - 20171025 - copy
 
Lecture 5 backpropagation
Lecture 5 backpropagationLecture 5 backpropagation
Lecture 5 backpropagation
 
Statistical analysis for recurrent events data with multiple competing risks
Statistical analysis for recurrent events data with multiple competing risksStatistical analysis for recurrent events data with multiple competing risks
Statistical analysis for recurrent events data with multiple competing risks
 
Lesson 9 transcendental functions
Lesson 9 transcendental functionsLesson 9 transcendental functions
Lesson 9 transcendental functions
 
2Multi_armed_bandits.pptx
2Multi_armed_bandits.pptx2Multi_armed_bandits.pptx
2Multi_armed_bandits.pptx
 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notes
 
Koh_Liang_ICML2017
Koh_Liang_ICML2017Koh_Liang_ICML2017
Koh_Liang_ICML2017
 

Recently uploaded

fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyDrAnita Sharma
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...anilsa9823
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 

Recently uploaded (20)

fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomology
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 

Hidden Markov Model

  • 1. Hidden Markov Model Nghia Bui Nov 2016 Andrei Markov (1856-1922)
  • 2. The weather problem • I talked to Jane for 𝐿 days through telephone. Everyday she told me what she does, either “walk” or “shop” or “clean”, only one! • I know, on a day, the weather in her city can be either “sunny” or “rainy”, only one! • But she didn’t tell me exactly the weather on the 𝐿 days, and how it affected her actions. • Then I have to figure out by myself!  HMM 2
  • 3. HMM is just a set of 3 rules • If today weather is 𝑺𝒊 then tmrw it will be 𝑺𝒋 with probability 𝒂𝒊𝒋 • When weather is 𝑺𝒊 Jane will do action 𝑶 𝒌 with probability 𝒃𝒊(𝒌) • In the 1st day, the weather is 𝑺𝒊 with probability 𝝅𝒊 3 https://en.wikipedia.org/wiki/Hidden_Markov_model
  • 4. What are hidden? • The states of weather 𝑆𝑖(𝑖 = 1 … 𝑁) {“sunny”, “rainy”} are not observable  they are hidden • The actions 𝑂 𝑘(𝑘 = 1 … 𝑀) {“walk”, “shop”, “clean”} are observed in an index sequence 𝑜ℎ ℎ = 1 … 𝐿 where 𝑜ℎ = 𝑘 1 ≤ 𝑘 ≤ 𝑀 4
  • 5. Two common tasks 1. Given a model 𝜆(𝑎, 𝑏, 𝜋) and a sequence of action indexes 𝑜 = 𝑜1, 𝑜2 … 𝑜 𝐿 please calculate the probability 𝑃(𝑜|𝜆) the model generates the sequence.  The forward algorithm 2. Given a sequence 𝑜, build a model 𝜆 so that 𝑃(𝑜|𝜆) is maximum.  The Baum-Welch algorithm 5
  • 6. The forward algorithm • Let 𝛼𝑖 ℎ be the probability of generating the sequence 𝑜1 … 𝑜ℎ(ℎ = 1 … 𝐿) and ending up at state 𝑆𝑖 • Using dynamic programming we have:  𝛼𝑖 ℎ = 𝑗=1 𝑁 𝛼𝑗 ℎ − 1 𝑎𝑗𝑖 𝑏𝑖(𝑜ℎ)  𝛼𝑖 1 = 𝜋𝑖 𝑏𝑖(𝑜1) • And result: 𝑃 𝑜 𝜆 = 𝑖=1 𝑁 𝛼𝑖(𝐿) 6
  • 7. The Baum-Welch algorithm • Given a model 𝜆 𝑎, 𝑏, 𝜋 , we use it to generate many sequences, but consider only the ones that emit 𝑜1, 𝑜2 … 𝑜 𝐿: Main idea: init with a random model and make it better incrementally 𝑆1 𝑆2 … 𝑆2 𝑆1 𝑆2 𝑆2 … 𝑆1 𝑆1 … … … … … 𝑆1 𝑆1 … 𝑆1 𝑆2 𝑜1 𝑜2 … 𝑜 𝐿−1 𝑜 𝐿 • Nothing is hidden in these sequences! Now we simply base on them to estimate 𝑎′, 𝑏′, 𝜋′ 7
  • 8. Estimate 𝑎′, 𝑏′, 𝜋′ • To estimate 𝑎′𝑖𝑗, count the transitions from 𝑆𝑖 to 𝑆𝑗 and to other states • To estimate 𝑏′ 𝑖(𝑘), count the appearances of 𝑆𝑖 that have action index 𝑜ℎ = 𝑘, also count all the appearances of 𝑆𝑖 • To estimate 𝜋′𝑖, count the appearances of 𝑆𝑖 at the first element of all sequences, and count the number of all sequences too • But, to count all of things above, we need … 8
  • 9. Forward and backward variables • Using the forward algorithm we have 𝛼𝑖 ℎ • Using the backward algorithm we have 𝛽𝑖 ℎ the probability of generating the sequence 𝑜ℎ+1 … 𝑜 𝐿(ℎ = 1 … 𝐿) starting from tmrw, given the state 𝑆𝑖 of today. Dynamic programming is used again:  𝛽𝑖 ℎ = 𝑗=1 𝑁 𝑎𝑖𝑗 𝑏𝑗(𝑜ℎ+1)𝛽𝑗 ℎ + 1  𝛽𝑖 𝐿 = 1 9
  • 10. Estimate 𝑎′ • Count transitions from 𝑆𝑖 to 𝑆𝑗: 𝜉𝑖𝑗 = ℎ=1 𝐿−1 𝛼𝑖(ℎ)𝑎𝑖𝑗 𝑏𝑗(𝑜ℎ+1)𝛽𝑗(ℎ + 1) • Thus: 𝑎′𝑖𝑗 = 𝜉𝑖𝑗 𝑘=1 𝑁 𝜉𝑖𝑘 10
  • 11. Estimate 𝑏′ • Count the appearances of state 𝑆𝑖: ℎ=1 𝐿 𝛼𝑖 ℎ 𝛽𝑖 ℎ • Thus: 𝑏′ 𝑖 𝑘 = ℎ=1,𝑜ℎ=𝑘 𝐿 𝛼𝑖 ℎ 𝛽𝑖 ℎ ℎ=1 𝐿 𝛼𝑖 ℎ 𝛽𝑖 ℎ 11
  • 12. Estimate 𝜋′ • Count the appearances of 𝑆𝑖 at the first element: 𝛼𝑖 1 𝛽𝑖 1 • Count the number of all sequences: 𝑃 𝑜 𝜆 = 𝑖=1 𝑁 𝛼𝑖 𝐿 • Thus: 𝜋′𝑖 = 𝛼𝑖 1 𝛽𝑖 1 𝑃 𝑜 𝜆 12
  • 13. Thank you! • Contact: katatunix@gmail.com 13