-
-
Notifications
You must be signed in to change notification settings - Fork 342
Feat : hidden_markov_model #253
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
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
Adds a new Hidden Markov Model (HMM) implementation for financial regime detection using an R6 class, including Baum–Welch (EM) training, Viterbi decoding, and helper utilities for regime labeling and summaries.
- Introduces HMM R6 class with fit, predict, posterior probability, and diagnostics.
- Includes example usage (guarded by if (FALSE)) for simulated data and basic signal generation.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 5 comments.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 5 comments.
Hidden Markov Model (HMM) – Quant Finance Overview
Purpose
Captures regime switching in financial markets — for example, transitions between bull and bear states.
Key Idea
The market is treated as a latent state machine, where:
Mathematically:
[
P(S_t | S_{t-1}) = A_{ij}, \quad P(O_t | S_t) = B_j(O_t)
]
where
Use Cases
Minimal R Implementation