GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ALGORITHM::MARKOVCHAIN (3)

.ds Aq ’

NAME

Algorithm::MarkovChain - Object oriented Markov chain generator

CONTENTS

SYNOPSIS



  use Algorithm::MarkovChain;

  my $chain = Algorithm::MarkovChain::->new();

  # learn about things from @symbols
  $chain->seed(symbols => \@symbols,
               longest => 6);

  # attempt to tell me something about the sky
  my @newness = $chain->spew(length   => 20,
                             complete => [ qw( the sky is ) ]);



DESCRIPTION

Algorithm::MarkovChain is an implementation of the Markov Chain algorithm within an object container.

It is implemented as a base class, Algorithm::MarkovChain::Base, with storage implementations of a hash (Algorithm::MarkovChain), and an fairly memory efficent implementation using glib (Algorithm::MarkovChain::GHash). DBI and MLDBM-friendly versions are planned.

Deriving alternate representations is intended to be straightforward.

METHODS

Algorithm::MarkovChain::->new() or $obj->new() Creates a new instance of the Algorithm::MarkovChain class.

Takes one optional parameter: recover_symbols

recover_symbols has meaning if your symbols differ from their true values when stringifyed. With this option enabled steps are taken to ensure that the original values for symbols are returned by the spew method.

$obj->seed() Seeds the markov chains from an example symbol stream.

Takes two parameters, one required symbols, one optional longest

symbols presents the symbols to seed from

longest sets an upper limit on the longest chain to construct. (defaults to 4)

$obj->spew() Uses the constructed chains to produce symbol streams

Takes four optional parameters complete, length, longest_subchain, force_length, stop_at_terminal and strict_start

complete provides a starting point for the generation of output. Note: the algorithm will discard elements of this list if it does not find a starting chain that matches it, this is infinite-loop avoidance.

length specifies the minimum number of symbols desired (default is 30)

stop_at_terminal directs the spew to stop chaining at the first terminal point reached

force_length ensures you get exactly length symbols returned (note this overrides the behaviour of stop_at_terminal)

strict_start makes the spew operation always take a known start state rather than selecting a sequence at random

$obj->increment_seen($sequence, $symbol) Increments the seeness of a symbol following a sequence.
$obj->recompute($sequence) Recompute the probabilities for a branch of the tree. Called towards the end of the seed operation for ’dirty’ sequences.

CW$obj->get_options($sequence)

Returns possible next symbols and probablities as a hash.

TODO

Documentation I need to explain Markov Chains, and flesh out the examples some more.
Fix bugs/respond to feature requests Just email me <richardc@unixbeard.net> and I’ll hit it with hammers...

BUGS

Hopefully not, though if they probably arise from my not understanding Markov chaining as well as I thought I did when coding commenced.

That or they’re jst stupid mistakes :)

AUTHOR

Richard Clamp <richardc@unixbeard.net>

SEE ALSO

perl(1).

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 180: You forgot a ’=back’ before ’=head2’
Around line 184: =back without =over
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ALGORITHM::MARKOVCHAIN (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.