Skip to content

Commit

Permalink
have spew_cost die if no x,y supplied.
Browse files Browse the repository at this point in the history
  • Loading branch information
zpmorgan committed Aug 6, 2012
1 parent dcc0935 commit 01b793a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/AI/Nerl/Model/Perceptron3.pm
Expand Up @@ -147,8 +147,8 @@ sub train_batch{

sub spew_cost{
my ($self, %args) = @_;
my $x = $args{x};
my $y = $args{y};
my $y = $args{y} // die 'need y';;
my $x = $args{x} // die 'need x';
my $lambda = $args{lambda} // .04;
my $alpha = $args{lambda} // .25;
my $theta1 = $self->theta1;
Expand All @@ -169,6 +169,7 @@ sub spew_cost{
print "COST: $J \n";
my $maxes = $a3->transpose->maximum_ind;;
my $labels = $y->transpose->maximum_ind;
#die $a3;
print "num correct(of ".($x->dim(0))."): ".(($labels==$maxes)->sum)."\n";
}

Expand Down

0 comments on commit 01b793a

Please sign in to comment.