260 likes | 559 Views
Accelerating Viterbi Algorithm. 20120814 Pei- Ching Li. Outline. Introduction of Viterbi Algorithm Example Architecture Parallel on CUDA MIDI hmmtrain Future Works. Introduction of Viterbi Algorithm.
E N D
Accelerating Viterbi Algorithm 20120814 Pei-Ching Li
Outline • Introduction of ViterbiAlgorithm • Example • Architecture • Parallel on CUDA • MIDI • hmmtrain • Future Works
Introduction of Viterbi Algorithm • a dynamic programming algorithm for finding the most likely sequence of hidden states called the Viterbi path. • Hidden Markov Model
Example O = Walk->Walk->Shop->Clean
Example O = Walk->Walk->Shop->Clean
Example O = Walk->Walk->Shop->Clean
Example O = Walk->Walk->Shop->Clean
Example O = Walk->Walk->Shop->Clean S = Sunny->Sunny->Rainy->Rainy
Parallel Part • CSE551 Final Project: Parallel Viterbi on a GPU • Authors:Seong Jae Lee, MiroEnev • Provenance:Autumm 2009, University of Washington
Architecture • Input • transition probability • emission probability • Algorithm • hmmgenerate • hmmviterbi • accuracy of hmmviterbi
Matlab 2011 • [SEQ, STATES] = HMMGENERATE(LEN,TRANSITIONS,EMISSIONS) • STATES = HMMVITERBI(SEQ,TRANSITIONS,EMISSIONS) • Use MATLAB Coder to generate C/C++ code
Parallel on CUDA • Focus on hmmviterbi() to accelerate • Calculate the values • Choose the maximum • reduction
MIDI • Score: • Length : 1 second • Hmmtrain : • unknown states • initial guesses for TRANS and EMIS hmmtrain (seq, TRANS_GUESS, EMIS_GUESS)
hmmtrain(seq, TRANS_GUESS, EMIS_GUESS) • TRANS_GUESS : 12x12 • C → D, D → E, E → F, F → G 0.8 • Others random • EMIS_GUESS : played or not • 0.9 vs. 0.1 • Not accepted
hmmtrain(seq, TRANS_GUESS, EMIS_GUESS) • seq • Source • Output of band-pass filter • Hmmtrain will use algo. • BaumWelch : hmmdecode • Calculates the posterior state probabilities of a sequence of emissions • Viterbi : hmmviterbi
hmmtrain • The results of models have big difference than the guess! • Can’t use the results to get the great states when running Viterbi algorithm.
Future Works • Finish the 3rd version. • Modify the guess models to get the better result!
Appendix 1 : O(nm2) • n stands for the number of observations • m is the number of possible states of an observation
Appendix 2 : Reference • CSE551 Final Project: Parallel Viterbi on a GPU • Authors:Seong Jae Lee, MiroEnev • Provenance:Autumm 2009, University of Washington
Appendix 2 : CSE551 Final Project : Parallel Viterbi on a GPU
Appendix 2 : CSE551 Final Project : Parallel Viterbi on a GPU
Appendix 3 : Auto-generated Probability Models • Random + constraint • tmp = (float)rand() / (float)RAND_MAX; • prob = (tmp <= constraint) ? 0 : tmp; • Guarantee probability of each row equals 1. • Verify the sequence conformed to the models. • hmmestimate(seq, states)
Appendix 3 : Auto-generated Probability Models • Viterbi algorithm • when back tracing the likely states, avoid to save the 0 state • (rand() % N) + 1