AI-NeuralNet-Kohonen

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.14	Fri May 05 20:19:00 2006 
	Updated SYNOPSIS from ::Visual code, and a minor bug:
	thanks to diligent eye of Przemek Blaskiewicz
	
0.132  Web Apr 17 11:40:00 2003
	Some minor interface changes.
	Created *::Input class

0.0131 Thu Mar 20 11:55:00 2003
	Added epoch_start callback.

0.013 Mon Mar 17 14:49:00 2003
	Added 'neighbour_factor' field
	Method 'load_file' becomes 'load_input', as we may allow
	the loading of map fiels too.

0.012 Fri Mar 14 11:49:00 2003
	Added some support for loading and saving in SOM_PAK file
	format; gaussian smoothing of the map.

lib/AI/NeuralNet/Kohonen.pm  view on Meta::CPAN


=item input_names

A name for each dimension of the input vectors.

=item map_dim_x

=item map_dim_y

The dimensions of the feature map to create - defaults to a toy 19.
(note: this is Perl indexing, starting at zero).

=item epochs

Number of epochs to run for (see L<METHOD train>).
Minimum number is C<1>.

=item learning_rate

The initial learning rate.

=item train_start

Reference to code to call at the begining of training.

=item epoch_start

Reference to code to call at the begining of every epoch
(such as a colour calibration routine).

=item epoch_end

Reference to code to call at the end of every epoch
(such as a display routine).

=item train_end

lib/AI/NeuralNet/Kohonen.pm  view on Meta::CPAN

(see L</PRIVATE METHOD _decay_learning_rate>).

See C<CONSTRUCTOR new> for details of applicable callbacks.

Returns a true value.

=cut

sub train { my ($self,$epochs) = (shift,shift);
	$epochs = $self->{epochs} unless defined $epochs;
	&{$self->{train_start}} if exists $self->{train_start};
	for my $epoch (1..$epochs){
		$self->{t} = $epoch;
		&{$self->{epoch_start}} if exists $self->{epoch_start};
		for (0..$#{$self->{input}}){
			my $target = $self->_select_target;
			my $bmu = $self->find_bmu($target);
			$self->_adjust_neighbours_of($bmu,$target);
		}
		$self->_decay_learning_rate;
		&{$self->{epoch_end}} if exists $self->{epoch_end};
	}
	&{$self->{train_end}} if $self->{train_end};
	return 1;



( run in 0.370 second using v1.01-cache-2.11-cpan-0d8aa00de5b )