search.cpan.org is shutting down
Daniel S. T. Hughes > Algorithm-BaumWelch-v0.0.2 > Algorithm::BaumWelch
Module Version: v0.0.2

# NAME

Algorithm::BaumWelch - Baum-Welch Algorithm for Hidden Markov Chain parameter estimation.

# VERSION

This document describes Algorithm::BaumWelch version 0.0.2

# SYNOPSIS

```    use Algorithm::BaumWelch;

# The observation series see http://www.cs.jhu.edu/~jason/.
my \$obs_series = [qw/ obs2 obs3 obs3 obs2 obs3 obs2 obs3 obs2 obs2
obs3 obs1 obs3 obs3 obs1 obs1 obs1 obs2 obs1
obs1 obs1 obs3 obs1 obs2 obs1 obs1 obs1 obs2
obs3 obs3 obs2 obs3 obs2 obs2
/];

# The emission matrix - each nested array corresponds to the probabilities of a single observation type.
my \$emis = {
obs1 =>  [0.3, 0.3],
obs2 =>  [0.3, 0.4],
obs3 =>  [0.4, 0.3],
};

# The transition matrixi - each row and column correspond to a particular state e.g. P(state1_x|state1_x-1) = 0.9...
my \$trans = [
[0.9, 0.1],
[0.1, 0.9],
];

# The probabilities of each state at the start of the series.
my \$start = [0.5, 0.5];

# Create an Algorithm::BaumWelch object.
my \$ba = Algorithm::BaumWelch->new;

# Feed in the observation series.
\$ba->feed_obs(\$obs_series);

# Feed in the transition and emission matrices and the starting probabilities.
\$ba->feed_values(\$trans, \$emis, \$start);

# Alternatively you can randomly initialise the values - pass it the number of hidden states -
# i.e. to determine the parameters we need to make a first guess).
# \$ba->random_initialise(2);

# Perform the algorithm.
\$ba->baum_welch;

# Use results to pass data.
# In VOID-context prints formated results to STDOUT.
# In LIST-context returns references to the predicted transition & emission matrices and the starting parameters.
\$ba->results;```

# DESCRIPTION

The Baum-Welch algorithm is used to compute the parameters (transition and emission probabilities) of an Hidden Markov Model (HMM). The algorithm calculates the forward and backwards probabilities for each HMM state in a series and then re-estimates the parameters of the model.

Algorithm::Viterbi

# DEPENDENCIES

'Carp' => '1.08', 'Math::Cephes' => '0.47', 'List::Util' => '1.19', 'Text::SimpleTable' => '2.0',

# WARNING

This module Baum-Welch implementation has been tested fairly extensively with 2-hidden state cases but as yet has been subject to little (almost no) testing with >2 hidden states.

Let me know.

# AUTHOR

Daniel S. T. Hughes `<dsth@cantab.net>`

Copyright (c) 2010, Daniel S. T. Hughes `<dsth@cantab.net>`. All rights reserved.