Ticket #12144 (closed enhancement: fixed)

Opened 17 months ago

Last modified 16 months ago

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

trac_12144.patch Download (11.0 KB) - added by was 17 months ago.
should apply to any sage since about sage-4.0
trac_12144.2.patch Download (11.0 KB) - added by was 16 months ago.
apply only this; fixes the noise issue (I hope)
trac_12144.3.patch Download (11.0 KB) - added by was 16 months ago.
apply only this; fixes final numerical noise issue ?

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

comment:2 Changed 17 months ago by was

  • Status changed from new to needs_review

comment:3 Changed 17 months ago by was

  • Status changed from needs_review to needs_work

Changed 17 months ago by was

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:6 Changed 17 months ago by jason

  • Authors set to William Stein

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:8 Changed 16 months ago by jdemeyer

  • Milestone changed from sage-4.8 to sage-5.0

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

apply only this; fixes the noise issue (I hope)

comment:10 Changed 16 months ago by was

  • Status changed from needs_work to needs_review

comment:11 Changed 16 months ago by jdemeyer

  • Status changed from needs_review to positive_review

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

apply only this; fixes final numerical noise issue ?

comment:13 Changed 16 months ago by was

  • Status changed from needs_work to needs_review

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
Note: See TracTickets for help on using tickets.