HMMs stem from a simple premise:

  • have a internal marhov model that is unobservable, and traversing its random walk at each tick.
  • external observation states, which are receive only marhov nodes that have a probability of observation based on internal state.
    • gets tricky, as if you observe blue, the internal state could either be happy or sad.
    • best chance when happy, as is 0.4
"\\usepackage{tikz}\n\\usetikzlibrary{arrows.meta, positioning}\n\n\\begin{document}\n\n\\begin{tikzpicture}[\n every node/.style={font=\\small},\n state/.style={circle, draw=black, thick, minimum size=1.5cm},\n obs/.style={rectangle, rounded corners=3pt, draw=black, thick,\n minimum width=1.3cm, minimum height=0.9cm, fill=gray!10},\n trans/.style={-{Stealth[length=6pt]}, thick},\n emit/.style={-{Stealth[length=5pt]}, dashed, gray}\n]\n\n\\node[state, fill=blue!15] (H) at (0, 0) {Happy};\n\\node[state, fill=orange!15] (S) at (5.5, 0) {Sad};\n\n\\draw[trans, bend left=25] (H) to node[above] {$a_{HS}=0.3$} (S);\n\\draw[trans, bend left=25] (S) to node[below] {$a_{SH}=0.4$} (H);\n\\draw[trans] (H) edge[loop above] node[above] {$0.7$} (H);\n\\draw[trans] (S) edge[loop above] node[above] {$0.6$} (S);\n\n\\node[obs, fill=red!20] (R) at (-1.2, -3.5) {Red};\n\\node[obs, fill=blue!20] (B) at (2.75, -3.5) {Blue};\n\\node[obs, fill=yellow!30] (Y) at (6.7, -3.5) {Yellow};\n\n\\draw[emit] (H) -- node[left, font=\\scriptsize] {$b_{H}(R)=0.6$} (R);\n\\draw[emit] (H) -- node[right, font=\\scriptsize] {$b_{H}(B)=0.4$} (B);\n\\draw[emit] (S) -- node[left, font=\\scriptsize] {$b_{S}(B)=0.3$} (B);\n\\draw[emit] (S) -- node[right, font=\\scriptsize] {$b_{S}(Y)=0.7$} (Y);\n\n\\node[font=\\footnotesize\\itshape, gray] at (-3, 0) {hidden $z_t$};\n\\node[font=\\footnotesize\\itshape, gray] at (-3, -3.5) {observed $x_t$};\n\n\\end{tikzpicture}\n\n\\end{document}" HappySadaHS=0:3aSH=0:40:70:6RedBlueYellowbH(R)=0:6bH(B)=0:4bS(B)=0:3bS(Y)=0:7hiddenztobservedxt
source code

HMMs are particularly useful when we seek to predict a sequence of unobservable states given our series of observable events.