Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Improve documentation for novices #38

Open
BioTurboNick opened this issue May 7, 2022 · 1 comment
Open

Improve documentation for novices #38

BioTurboNick opened this issue May 7, 2022 · 1 comment

Comments

@BioTurboNick
Copy link

I'm coming in relatively fresh to HMMs and I'm having trouble matching up terms I'm seeing in other work.

  1. "Emission matrix" doesn't appear in the documentation - I gather it can be provided in place of B, but the documentation doesn't show that or describe its form.

  2. The form the "Transition matrix" should take isn't explicitly documented.

I'd be happy to make a contribution here, once I understand them.

@maxmouchet
Copy link
Owner

maxmouchet commented May 15, 2022

Hi,

Here is an example with the Weather guessing game from Wikipedia.
Does that makes things clearer?

# K: number of states

# a[i] = probability of starting in i
# vector of length K
start_probability = [0.6, 0.4]

# A[i,j] = probability of going from i to j
# matrix of size KxK
transition_probability = [
    0.7 0.3; # i=1 (Rainy)
    0.4 0.6  # i=2 (Sunny)
]

# B[i] = probability distribution of the observations in state i
# vector of size K
# We can model an emission matrix with the discrete `Categorical` distribution:
emission_probability = [
    # [walk, shop, clean]
    Categorical([0.1, 0.4, 0.5]), # i=1 (Rainy)
    Categorical([0.6, 0.3, 0.1]), # i=2 (Sunny)
]

hmm = HMM(start_probability, transition_probability, emission_probability)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants