Speeding Up HMM Decoding and Training by Exploiting Sequence Repetitions
This page contains links to the conference and journal versions of this paper, as well as the conference presentation and a couple of implementations of some of the ideas presented in the paper. The code may be download and used for scholarly and academic purposes, in which case we request that you include a reference to our paper.
AbstractWe present a method to speed up the dynamic program algorithms used for solving the HMM decoding and training problems for discrete time-independent HMMs. We discuss the application of our method to Viterbi's decoding and training algorithms, as well as to the forward-backward and Baum- Welch algorithms. Our approach is based on identifying repeated substrings in the observed input sequence. Initially, we show how to exploit repetitions of all sufficiently small substrings (this is similar to the Four Russians method). Then, we describe four algorithms based alternatively on run length encoding (RLE), Lempel-Ziv (LZ78) parsing, grammar-based compression (SLP), and byte pair encoding (BPE). Compared to Viterbi's algorithm, we achieve speedups of Theta(log n) using the Four Russians method, Omega(r/log r) using RLE, Omega(log n / k) using LZ78, Omega(r/k) using SLP, and Omega(r) using BPE, where k is the number of hidden states, n is the length of the observed sequence and r is its compression ratio (under each compression scheme). Our experimental results demonstrate that our new algorithms are indeed faster in practice. We also discuss a parallel implementation of our algorithms.
C++ Implementations of different variants of Viterbi's algorithmThe different C++ implementations were used for producing the results section of the paper. This is not a complete implementation of Viterbi's algorithm. All variants assume DNA sequences (alphabet size 4) and only compute the probability of the most probable sequence of hidden states. Traceback of the optimal sequence itself is not implemneted, but should be easy to add. The code is not well documented, but is not very complicated either. I will be happy to try and answer questions that arise.
Multithreaded Java ImplementationShay Mozes coded this as a final project for a multiprocessor synchronization class. In the project, many variants of the "Four Russians" version of the algorithm were implemented, as well as the traceback step for recovering the optimal sequence of hidden states. The variants differ in the ways and extent to which parallelization is employed. See the project report for details. One of these variants is a reasonable sequential implementation in Java. It is not as efficient as the DNA-special purpose C++ code, but not too bad either. The source code can be found here .