AI::NeuralNet::SOM::Hexa - Perl extension for Kohonen Maps (hexagonal topology)
use AI::NeuralNet::SOM::Hexa; my $nn = new AI::NeuralNet::SOM::Hexa (output_dim => 6, input_dim => 3); # ... see also base class AI::NeuralNet::SOM
The constructor takes the following arguments (additionally to those in the base class):
output_dim
A positive, non-zero number specifying the diameter of the hexagonal. 1 creates one with a single hexagon, 2 one with 4, 3 one with 9. The number plays the role of a diameter.
1
2
3
Example:
my $nn = new AI::NeuralNet::SOM::Hexa (output_dim => 6, input_dim => 3);
Returns the radius (half the diameter).
Returns the diameter (= dimension) of the hexagon.
$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).
my $m = $nn->map; for my $x (0 .. $nn->diameter -1) { for my $y (0 .. $nn->diameter -1){ warn "vector at $x, $y: ". Dumper $m->[$x]->[$y]; } }
This array represents a hexagon like this (ASCII drawing is so cool):
<0,0> <0,1> <1,0> <0,2> <1,1> <2,0> <0,3> <1,2> <2,1> <3,0> ...............................
Not implemented.
Robert Barta, <rho@devc.at>
Copyright (C) 200[78] 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.