AI-Nerl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
examples/digits/digits.pl view on Meta::CPAN
if ($pass%200==0){
warn $delta(100:104);
warn $out_neurons(100:104);
}
show784($delta(:,0));
show784($delta(:,6));
show784($delta(:,4));
}
#die join (',',$nncost->dims);
use PDL::Graphics2D;
sub show784{
my $w = shift;
$w = $w->squeeze;
my $min = $w->minimum;
$w -= $min;
my $max = $w->maximum;
$w /= $max;
$w = $w->reshape(28,28);
imag2d $w;
}
sub sigmoid{
my $foo = shift;
return 1/(1+E**-$foo);
}
sub logistic{
#find sigmoid before calling this.
#grad=logistic(sigmoid(foo))
my $foo = shift;
return $foo * (1-$foo);
}
lib/AI/Nerl.pm view on Meta::CPAN
);
has basis => (
is => 'ro',
isa => 'AI::Nerl',
required => 0,
);
#initialize $self->network, but don't train.
# any parameters AI::Nerl::Network takes are fine here.
sub init_network{
my $self = shift;
my %nn_params = @_;
#input layer size:
unless ($nn_params{l1}){
if ($self->basis){
$nn_params{l1} = $self->basis->network->l1 + $self->basis->network->l2;
} elsif($self->train_x) {
$nn_params{l1} ||= $self->train_x->dim(1);
}
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.183 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )