AI-NeuralNet-BackProp

 view release on metacpan or  search on metacpan

examples/ex_bmp.pl  view on Meta::CPAN

=begin

	File:   examples/ex_bmp.pl
	Author: Josiah Bryan, <jdb@wcoil.com>
	Desc:
	
		This demonstrates simple classification of 6x6 bitmaps.

=cut

	use AI::NeuralNet::BackProp;
	use Benchmark;

	# Set resolution
	my $xres=5;
	my $yres=5;
	
	# Create a new net with 3 layes, $xres*$yres inputs, and 1 output
	my $net = AI::NeuralNet::BackProp->new(2,$xres*$yres,1);
	
	# Disable debugging
	$net->debug(4);
	
	# Create datasets.
	my @data = ( 
		[	2,1,1,2,2,
			2,2,1,2,2,
			2,2,1,2,2,
			2,2,1,2,2,
			2,1,1,1,2	],		[	1	],
		
		[	1,1,1,2,2,
			2,2,2,1,2,
			2,1,1,1,2,
			1,2,2,2,2,
			1,1,1,1,2	],		[	2	],
		
		[	2,1,1,1,2,
			1,2,2,2,2,
			1,1,1,2,2,
			1,2,2,2,2,
			2,1,1,1,2	],		[	3	],
		
		[	1,2,2,1,2,
			1,2,2,1,2,
			1,1,1,1,2,
			2,2,2,1,2,
			2,2,2,1,2	],		[	4	],
		
		
		[	1,1,1,1,2,
			1,2,2,2,2,
			1,1,1,1,2,
			2,2,2,1,2,
			1,1,1,1,2	],		[	5	],
		
	);
    
    
	$net->range(1,5);
	
	# If we havnt saved the net already, do the learning
	if(!$net->load('images.net')) {
		print "\nLearning started...\n";
		
		# Make it learn the whole dataset $top times
		my @list;



( run in 0.884 second using v1.01-cache-2.11-cpan-39bf76dae61 )