-
-
Notifications
You must be signed in to change notification settings - Fork 342
Feat viterbi #232
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
Feat viterbi #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an implementation of the Viterbi Algorithm for Hidden Markov Model (HMM) decoding. The algorithm finds the most probable sequence of hidden states given observed events using dynamic programming.
Key Changes
- Implements the core Viterbi algorithm with initialization, recursion, and backtracking steps
- Provides a complete working example using a weather prediction scenario
- Includes comprehensive documentation explaining the algorithm, complexity, and usage
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
|
It's already implemented here quantitative_finance/hidden_markov_model.r under a different name. Please correct if they are different |
This R program implements the Viterbi Algorithm — a dynamic programming method used in Hidden Markov Models (HMMs) to find the most probable sequence of hidden states that could have produced a given sequence of observed events.
It works in three main steps:
Initialization: Calculates initial probabilities for each state using start and emission probabilities.
Recursion: Iteratively updates probabilities for each observation by considering all possible previous states.
Backtracking: Reconstructs the most likely state sequence from the stored backpointers.
Use case: Speech recognition, weather prediction, bioinformatics (e.g., gene sequence analysis).
Time Complexity: O(N × T)
Space Complexity: O(N × T)