AI-Nerl
view release on metacpan or search on metacpan
0.01 Jan 11, 2012
* Seems to work.
0.02 Jan 11, 2012
* fixed version.
0.03 Jan 12, 2012
* Hopefully fixing a PDL::Graphics2D optional dependency
which caused this to fail most automated tests.
* Added Modern::Perl and ExtUtils::MakeMaker dependencies
which caused this to fail the rest of the tests.
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Makefile.PL view on Meta::CPAN
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "AI::Nerl",
"PREREQ_PM" => {
"ExtUtils::MakeMaker" => 0,
"Modern::Perl" => 0,
"Moose" => 0,
"PDL" => 0
},
"VERSION" => "0.03",
"test" => {
"TESTS" => "t/*.t"
}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
examples/digits/deep_digits.pl view on Meta::CPAN
scale_input => 1/256,
);
$nerl->init_network(l1 => 784, l3=>10, l2=>7);#method=batch,hidden=>12345,etc
my $prev_nerl = $nerl;
my $prev_cost = 10000;
my $passes=0;
for(1..3000){
my @test = ($images(9000:9999)->sever,$y(9000:9999)->sever);
my $n = int rand(8000);
my $m = $n+499;
my @train = ($images->slice("$n:$m")->copy, $y->slice("$n:$m")->copy);
$nerl->train(@train,passes=>10);
my ($cost, $nc) = $nerl->cost( @test );
print "cost:$cost\n,num correct: $nc / 1000\n";
# $nerl->network->show_neuron(1);
$passes++;
if ($cost < $prev_cost or $passes<10){
$prev_cost = $cost;
$prev_nerl = $nerl;
} else { # use $nerl as basis for $nerl
$passes=0;
print "New layer!";
examples/digits/digits.pl view on Meta::CPAN
my $y = identity(10)->range($labels->transpose)->sever;
$y *= 2;
$y -= 1;
say 't10k data loaded';
my $nerl = AI::Nerl->new(
# type => image,dims=>[28,28],...
scale_input => 1/256,
# train_x => $images(0:99),
# train_y => $y(0:99),
# test_x => $images(8000:8999),
# test_y => $y(8000:8999),
# cv_x => $images(9000:9999),
# cv_y => $y(9000:9999),
);
$nerl->init_network(l1 => 784, l3=>10, l2=>80,alpha=>.45);#method=batch,hidden=>12345,etc
for(1..300){
my $n = int rand(8000);
my $m = $n+999;
my $ix = $images->slice("$n:$m");
lib/AI/Nerl.pm view on Meta::CPAN
use PDL;
use AI::Nerl::Network;
# ABSTRACT: Neural networks with backpropagation.
# main_module
our $VERSION = .03;
#A Nerl is a mechanism to build neural networks?
#Give it training,test, and cv data?
#it settles on a learning rate and stuff?
#or maybe it's also a language for guided training?
#or maybe a visual gui thing?
#Not exactly sure. Maybe I'm tinkering with forces better left alone.
#That's a great excuse for failing horribly.
=head1 AI::Nerl - A sort of stackable neural network builder thing.
=head1 SYNOPSIS
lib/AI/Nerl.pm view on Meta::CPAN
isa => 'Num',
default => 30,
);
has [qw/ train_x
train_y /] => (
is => 'ro',
isa => 'PDL',
required => 0, #training can be done manually.
);
has [qw/ test_x cv_x
test_y cv_y /] => (
is => 'ro',
isa => 'PDL',
required => 0,
);
has network => (
required=>0,
is => 'rw',
isa => 'AI::Nerl::Network',
);
use Test::More tests=>2;
use Modern::Perl;
use PDL;
use_ok('AI::Nerl');
{
my $nerl = AI::Nerl->new();
isa_ok($nerl,'AI::Nerl');
}
{
my $x = pdl([0,0,1,1],[0,1,0,1]);
t/nerl_network.t view on Meta::CPAN
use Test::More tests=>714;
use Modern::Perl;
use PDL;
use PDL::NiceSlice;
use_ok('AI::Nerl');
use_ok('AI::Nerl::Network');
{
my $nn = AI::Nerl::Network->new(l1=>2,l2=>2);
isa_ok($nn,'AI::Nerl::Network');
}
( run in 0.368 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )