Ticket #12144 (closed enhancement: fixed)
better document a technical confusing point in the Hidden Markov Model code
| Reported by: | was | Owned by: | amhou |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-5.0 |
| Component: | statistics | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Jason Grout |
| Authors: | William Stein | Merged in: | sage-5.0.beta3 |
| Dependencies: | Stopgaps: |
Description (last modified by was) (diff)
I was reading the Continuous Hidden Markov Model code and trying to understand how probabilities are defined in a certain context, and got confused. So I added some comments to de-confuse me. Hence this patch.
There is small change in the code itself, where I had checked for "0" instead of checking for smaller than min_sd in one line. This makes the code (1) work much better with actual real world examples, and (2) is consistent with the old ghmm C library from sage-3.x that this code was supposed to replace.
See all #12146 for feature enhancements.
Attachments
Change History
comment:1 Changed 17 months ago by was
- Summary changed from better document a technical confusing points in the Hidden Markov Model code to better document a technical confusing point in the Hidden Markov Model code
Changed 17 months ago by was
-
attachment
trac_12144.patch
added
should apply to any sage since about sage-4.0
comment:4 Changed 17 months ago by was
- Status changed from needs_work to needs_review
- Description modified (diff)
comment:5 Changed 17 months ago by jason
- Reviewers set to Jason Grout
Thanks for the doc clarifications, and the math changes make sense, though I'm certainly not a HMM expert, so I don't know how to judge the idea that the changes are more useful. However, it does apply and passes tests, so if this "review" is enough, set this to positive review.
comment:7 Changed 16 months ago by jason
- Status changed from needs_review to positive_review
No one else has looked at this, so I guess my review will stand. Positive review, and thanks for the work!
comment:9 Changed 16 months ago by jdemeyer
- Status changed from positive_review to needs_work
I get a numerical noise doctest error against sage-5.0.beta1. I lost the exact doctest error, but it's something trivial.
Changed 16 months ago by was
-
attachment
trac_12144.2.patch
added
apply only this; fixes the noise issue (I hope)
comment:12 Changed 16 months ago by jdemeyer
- Status changed from positive_review to needs_work
There is still numerical noise on 32-bit systems:
sage -t --long -force_lib devel/sage/sage/stats/hmm/chmm.pyx
**********************************************************************
File "/Users/buildbot/build/sage/moufang-1/moufang_full/build/sage-5.0.beta2/devel/sage-main/sage/stats/hmm/chmm.pyx", line 1354:
sage: m.baum_welch(v, min_sd=1)
Expected:
(-12.617885761692419, 1000)
Got:
(-12.617885761692417, 1000)
**********************************************************************
Changed 16 months ago by was
-
attachment
trac_12144.3.patch
added
apply only this; fixes final numerical noise issue ?
comment:14 Changed 16 months ago by jason
- Status changed from needs_review to positive_review
All tests in the file still pass for me; positive review. I see that the doctest above is fixed as well so it should pass.
comment:15 Changed 16 months ago by jdemeyer
- Status changed from positive_review to closed
- Resolution set to fixed
- Merged in set to sage-5.0.beta3
