Skip to content

Instead of recomputing log()s of @a, @b, and @pi as needed, this does it...#1

Open
jimlindstrom wants to merge 1 commit into
dtkirsch:masterfrom
jimlindstrom:pre-compute-logarithms
Open

Instead of recomputing log()s of @a, @b, and @pi as needed, this does it...#1
jimlindstrom wants to merge 1 commit into
dtkirsch:masterfrom
jimlindstrom:pre-compute-logarithms

Conversation

@jimlindstrom

Copy link
Copy Markdown

... once, lazily. @log_a, @log_b, @log_pi are calculated the first time they're needed. These are also invalidated (then recalculated, as needed) by the various training methods.

I'm using HMM to estimate the key of a musical phrase, in https://github.com/jimlindstrom/multi_markov_composer/blob/key-detection/lib/note_queue.rb. When repeatedly calling decode() and likelihood() for different sequences, but without retraining, I noticed that log() was being called a LOT. Precalculating the logs makes my usage of HMM about 2x faster.

… it once, lazily. @log_a, @log_b, @log_pi are calculated the first time they're needed. These are also invalidated (then recalculated, as needed) by the various training methods.
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

Successfully merging this pull request may close these issues.

1 participant