Algorithm-ExpectationMaximization
view release on metacpan or search on metacpan
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
mask => $mask,
class_priors => [0.6, 0.2, 0.2],
K => 3,
max_em_iterations => 300,
seeding => 'manual',
seed_tags => ['a26', 'b53', 'c49'],
terminal_output => 1,
);
# This example call to the constructor also illustrates how you can inject class
# priors into the clustering process. The class priors are the prior probabilities
# of the class distributions in your dataset. As explained later, injecting class
# priors in the manner shown above makes statistical sense only for the case of
# manual seeding. When you do inject class priors, the order in which the priors
# are expressed must correspond to the manually specified seeds for the clusters.
# After the invocation of the constructor, the following calls are mandatory
# for reasons that should be obvious from the names of the methods:
$clusterer->read_data_from_file();
srand(time);
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$clusterer->read_data_from_file()
This is a required call after the constructor is invoked. As
you would expect, this call reads in the data for
clustering.
=item B<seed_the_clusters():>
$clusterer->seed_the_clusters();
This is also a required call. It processes the option you
supplied for C<seeding> in the constructor call to choose
the data elements for seeding the C<K> clusters.
=item B<EM():>
$clusterer->EM();
This is the workhorse of the module, as you would expect.
The means, the covariances, and the priors estimated by this
method are stored in instance variables that are subsequently
( run in 0.682 second using v1.01-cache-2.11-cpan-8d75d55dd25 )