AI::NeuralNet::SOM::Rect - Perl extension for Kohonen Maps (rectangular topology)
use AI::NeuralNet::SOM::Rect; my $nn = new AI::NeuralNet::SOM::Rect (output_dim => "5x6", input_dim => 3); $nn->initialize; $nn->train (30, [ 3, 2, 4 ], [ -1, -1, -1 ], [ 0, 4, -3]); print $nn->as_data;
The constructor takes the following arguments (additionally to those in the base class):
output_dim
A string of the form "3x4" defining the X and the Y dimensions.
Example:
my $nn = new AI::NeuralNet::SOM::Rect (output_dim => "5x6", input_dim => 3);
$m = $nn->map
This method returns the 2-dimensional array of vectors in the grid (as a reference to an array of references to arrays of vectors). The representation of the 2-dimensional array is straightforward.
my $m = $nn->map; for my $x (0 .. 5) { for my $y (0 .. 4){ warn "vector at $x, $y: ". Dumper $m->[$x]->[$y]; } }
print $nn->as_data
This methods creates a string containing the raw vector data, row by row. This can be fed into gnuplot, for instance.
http://www.ai-junkie.com/ann/som/som1.html
Robert Barta, <rho@devc.at>
Copyright (C) 2007 by Robert Barta
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install AI::NeuralNet::SOM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::NeuralNet::SOM
CPAN shell
perl -MCPAN -e shell install AI::NeuralNet::SOM
For more information on module installation, please visit the detailed CPAN module installation guide.