AI-NeuralNet-Kohonen-Visual
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Kohonen/Visual.pm view on Meta::CPAN
use vars qw/$VERSION/;
$VERSION = 0.3; # 05 May 2006 pod and packaging
=head1 NAME
AI::NeuralNet::Kohonen::Visual - Tk-based Visualisation
=head1 SYNOPSIS
Test the test file in this distribution, or:
package YourClass;
use base "AI::NeuralNet::Kohonen::Visual";
sub get_colour_for { my ($self,$x,$y) = (shift,shift,shift);
# From here you return a TK colour name.
# Get it as you please; for example, values of a 3D map:
return sprintf("#%02x%02x%02x",
(int (255 * $self->{map}->[$x]->[$y]->{weight}->[0])),
(int (255 * $self->{map}->[$x]->[$y]->{weight}->[1])),
t/AI-NeuralNet-Kohonen-Visual.t view on Meta::CPAN
package Visual_and_RGB_test;
use lib "../lib";
use Test::More tests => 14;
my $delay = 1;
use_ok( "AI::NeuralNet::Kohonen" => 0.14 );
use_ok( "AI::NeuralNet::Kohonen::Visual" => 0.3);
diag "# Test 1 - basic confirmations that object-properties work correctly\n";
$net = AI::NeuralNet::Kohonen::Visual->new(
display => 'hex',
map_dim_x => 14,
map_dim_y => 10,
display_scale => 20,
epochs => 49,
show_bmu => 1,
targeting => 1,
table =>
t/AI-NeuralNet-Kohonen-Visual.t view on Meta::CPAN
$net->train;
diag "Will automatically destroy this window in $delay seconds";
$net->{_mw}->after($delay*1000, sub{ $net->{_mw}->destroy } );
$net->main_loop;
pass;
diag "# Test 2 ... this is *slow*, sorry\n";
$net = AI::NeuralNet::Kohonen::Visual->new(
display => 'hex',
map_dim => 39,
epochs => 19,
neighbour_factor => 2,
targeting => 1,
table=>
"3
1 0 0 red
0 1 0 yellow
( run in 0.966 second using v1.01-cache-2.11-cpan-a5abf4f5562 )