My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information

jHMM is a library and application for handling Hidden Markov Models that is written in Java. The models are encoded in a simple XML format that allows you to have arbitrary states, transitions, and alphabets. The library implements sequence state predictions and Baum-Welch training of the model parameters.


Build the code with ant:

cd hmm
ant jar


By default, the jar file is setup to generate a prediction from a model and input sequence:

java -jar dist/jhmm.jar model.xml input.txt

You can run a test by doing the following:

cd hmm-data
java -jar ../hmm/dist/jhmm.jar ../models/two-dice-model.xml dice.txt

and you get the output:

Score = -178.57415471540796

You can also run several other programs using the script:

cd hmm
./ ../models/two-dice-model.xml ../hmm-data/dice.txt

The following tools are available:

  • - the forward algorithm output
  • - generates random output according to your model
  • - check the syntax of your model
  • - calculate the most likely state for a sequence
  • - train a model on a set of sequences
Powered by Google Project Hosting