NAME

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

VERSION

This document describes Algorithm::BaumWelch version 0.0.1

SYNOPSIS

use Algorithm::BaumWelch;

# The observation series.
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.
my $emis = { 
    obs1 =>  [0.7, 0.1], 
    obs2 =>  [0.2, 0.2], 
    obs3 =>  [0.1, 0.7], 
           };

# The transition matrix.           
my $trans = [ 
                [0.5, 0.5], 
                [0.5, 0.5], 
            ];

my $start = [0.5, 0.5];

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.
# $ba->random_initialise(2);
 
# Perform the algorithm.
$ba->baum_welch;

# 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 HMM. The algorithm calculates the forward and backwards probabilities for each HMM state and then re-estimates the parameters of the model. This module has been tested with a number of 2-hidden state cases but as yet has been subject to little testing with more than 2 hidden states.

DEPENDENCIES

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

BUGS AND LIMITATIONS

AUTHOR

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

LICENCE AND COPYRIGHT

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

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.

In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 68:

Non-ASCII character seen before =encoding in 'Baum–Welch'. Assuming UTF-8