| AI-NeuralNet-Kohonen documentation | Contained in the AI-NeuralNet-Kohonen distribution. |
AI::NeuralNet::Kohonen::Input - an input vector for AI::NeuralNet::Kohonen
Implimentation of an input vector for the Kohonen SOM: AI::NeuralNet::Kohonen.
Scalar - the number of dimensions of this input vector.
Need not be supplied if values is supplied.
Reference to an array containing the values for this
input vector. There should be one entry for each dimension,
with unknown values having the value undef.
Optional class label string for this input vector.
This implimentation Copyright (C) Lee Goddard, 2003. All Rights Reserved.
Available under the same terms as Perl itself.
| AI-NeuralNet-Kohonen documentation | Contained in the AI-NeuralNet-Kohonen distribution. |
package AI::NeuralNet::Kohonen::Input; use vars qw/$VERSION $TRACE/; $VERSION = 0.1; $TRACE = 1;
use strict; use warnings; use Carp qw/cluck carp confess croak/;
sub new { my $class = shift; my %args = @_; my $self = bless \%args,$class; if (not defined $self->{values}){ if (not defined $self->{dim}){ cluck "No {dim} or {weight}!"; return undef; } $self->{values} = []; } elsif (not ref $self->{values}){ cluck "{values} not supplied!"; return undef; } elsif (ref $self->{values} ne 'ARRAY') { cluck "{values} should be an array reference, not $self->{values}!"; return undef; } elsif (defined $self->{dim} and defined $self->{values} and $self->{dim} ne $#{$self->{values}}){ cluck "{values} and {dim} do not match!"; return undef; } else { $self->{dim} = $#{$self->{values}}; } return $self; } 1; __END__