AI::NeuralNet::Kohonen::Input - an input vector for AI::NeuralNet::Kohonen


AI-NeuralNet-Kohonen documentation Contained in the AI-NeuralNet-Kohonen distribution.

Index


Code Index:

NAME

Top

AI::NeuralNet::Kohonen::Input - an input vector for AI::NeuralNet::Kohonen

DESCRIPTION

Top

Implimentation of an input vector for the Kohonen SOM: AI::NeuralNet::Kohonen.

CONSTRUCTOR (new)

Top

dim

Scalar - the number of dimensions of this input vector. Need not be supplied if values is supplied.

values

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.

class

Optional class label string for this input vector.

SEE ALSO

Top

The AI::NeuralNet::Kohonen.

AUTHOR AND COYRIGHT

Top

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__