The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  use AI::NeuralNet::FastSOM::Hexa;
  my $nn = new AI::NeuralNet::FastSOM::Hexa (output_dim => 6,
                                         input_dim  => 3);
  # ... see also base class AI::NeuralNet::FastSOM

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::FastSOM::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

Rick Myers, <jrm@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2016 by Rick Myers

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.