Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for parallel hmm sampler #341

Open
calebweinreb opened this issue Sep 5, 2023 · 5 comments
Open

Add support for parallel hmm sampler #341

calebweinreb opened this issue Sep 5, 2023 · 5 comments

Comments

@calebweinreb
Copy link
Contributor

Currently there are associative scan implementations for hmm smoothing and filtering, but not for sampling.

@AdrienCorenflos
Copy link
Collaborator

AdrienCorenflos commented Sep 5, 2023 via email

@slinderman
Copy link
Collaborator

@AdrienCorenflos, I think @calebweinreb has actually come up with a clever way to implement the HMM (and LGSSM) sampling with associative_scan! Curious what you think of his implementation in this PR #342. You can see the corresponding parallel LGSSM sampler here.

@AdrienCorenflos
Copy link
Collaborator

AdrienCorenflos commented Sep 6, 2023 via email

@calebweinreb
Copy link
Contributor Author

Hi Adrien,

The way I think about the algorithm, each associative scan element is a function $E_{st}: [K] \to [K]$ where $E_{st}(i) \mapsto z_s \sim P(z_s \mid x_{1:t-1}, z_t=i)$. The functions can be thought of as draws from a random process. The operator is function composition and it's associative because function composition is associative.

@slinderman
Copy link
Collaborator

I think the other necessary ingredient to the proof is that the function composition $E_{su} = E_{st} \circ E_{tu}$ defined by $E_{su}(i) = E_{st}(E_{tu}(i))$ ensures that $E_{su}(i) \mapsto z_s \sim P(z_s \mid x_{1:u-1}, z_u=i)$. Moreover, $(E_{su}(i), E_{tu}(i))$ are jointly distributed as $P(z_s, z_t \mid x_{1:u-1}, z_u=i)$. These follow from the fact that $z_s$ is conditionally independent of $x_{t:u-1}$ given $z_t$ in an HMM.

Finally, note that the base cases $E_{s,s+1}$ are straightforward to sample given the filtering distributions. The final message is defined as $E_{T,T+1} \triangleq E_T \mapsto z_T \sim p(z_T \mid x_{1:T})$.

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

No branches or pull requests

3 participants