NAME

AI::NeuralNet::SOM::Hexa - Perl extension for Kohonen Maps (hexagonal topology)

SYNOPSIS

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

INTERFACE

Constructor

The constructor takes the following arguments (additionally to those in the base class):

output_dim : (mandatory, no default)

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.

Example:

my $nn = new AI::NeuralNet::SOM::Hexa (output_dim => 6,
                                       input_dim  => 3);

Methods

radius

Returns the radius (half the diameter).

diameter

Returns the diameter (= dimension) of the hexagon.

map

$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).

Example:

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>
...............................
as_string

Not implemented.

as_data

Not implemented.

AUTHOR

Robert Barta, <rho@devc.at>

COPYRIGHT AND LICENSE

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.