16.11.2014 Views

MADS BAGGESEN - 20042326

MADS BAGGESEN - 20042326

MADS BAGGESEN - 20042326

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Abstract<br />

In this master’s thesis I implement and evaluate an alternative representation<br />

of hidden Markov models (HMMs), focusing on sparse HMMs. The<br />

reason for working with sparse HMMs is that the classic algorithms all<br />

assume that the model is completely connected, and have the running<br />

time of O(TN 2 ), where T is the length of the observed sequence and N<br />

is the number of states. The representation that I use give another bound<br />

namely O(TK) where K is the number of transitions with a positive<br />

transition probability. This bound is no different from the N 2 bound for<br />

completely connected HMMs, but when the model is sparse the O(TK)<br />

will be better – and for some models even linear in the size of the model.<br />

These very sparse models, with only a linear number of transitions, do<br />

occur in practise and are among others used for sequence alignment. Durbin<br />

et al. (2006) uses a family of models called profile HMMs, where each<br />

state is only connected to three other states. These profile models are used<br />

as a generel example throughout the thesis.<br />

The structure of the thesis follows the working process so I will first<br />

present the generel theory of the main algorithms for working with HMMs<br />

and based on that I present different implementations of the forward algorithm.<br />

I first produce a naive implementation which I use as a base<br />

line when comparing my other implementations. Having the naive implementation<br />

running I change the memory layout to get more sequencial<br />

reads and by that I make significant improvements in the running time,<br />

without changing the memory usage. Based on the improved memory<br />

layout I then discuss and evaluate different strategies for splitting the<br />

problem up into smaller chunks suitable for working in different threads.<br />

My final implementation is a threaded implementation using pthreads<br />

and the improved memory layout. This turns out to work very well, but<br />

the increase in efficiency decreases fast when I use four threads or more.<br />

The conclusion is that the new algorithm gives a large performance<br />

boost on sparse models and can even compete on complete models. I<br />

suggest continuing with this strategy, especially for sparse models.<br />

iii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!