blib/lib/AI/NeuralNet/FastSOM.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 4 totaltotal 84.2% 32 / 38 CC 3 SCAR 4.4
CC
3
Cov
96%
new
2.0
label
2.0
value
2.0
CRAP 1.6
« blib/lib/AI/NeuralNet/FastSOM/Hexa.pm ↑ Summary FastSOM.xs »
1 package AI::NeuralNet::FastSOM;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 our $VERSION = '0.19';
8  
9 0 ▶sub new { die 'Dont use this class directly' }
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
10  
11 3 ▶sub label {
Subroutine label: called CC=2 SCAR=6.9
Pod undocumented
12 3 my ($self, $x, $y, $l) = @_;
13 return defined $l
14 ? $self->{labels}->[$x]->[$y] = $l
15 3 ▶ : $self->{labels}->[$x]->[$y];
Branch: 1 branch
BranchTrueFalseTotal
defined $l ? : 1 2 3
16 }
17  
18 90 ▶sub value {
Subroutine value: called CC=2 SCAR=6.9
Pod undocumented
19 90 my ($self, $x, $y, $v) = @_;
20 return defined $v
21 ? $self->{map}[$x][$y] = $v
22 90 ▶ : $self->{map}[$x][$y];
Branch: 1 branch
BranchTrueFalseTotal
defined $v ? : 2 88 90
23 }
24  
25 162 ▶sub mean_error {
Subroutine mean_error: called CC=1 SCAR=0.0
Pod undocumented
26 162 my $self = shift;
27 162 my $error = 0;
28 486 map { $error += $_ } # then add them all up
29 162 map { ( $self->bmu($_) )[2] } # then find the distance
30 @_; # take all data vectors
31 162 return ($error / scalar @_); # return the mean value
32 }
33  
34 11 XSLoader::load(__PACKAGE__);
35  
36 11 1;
37  
38 __END__
« blib/lib/AI/NeuralNet/FastSOM/Hexa.pm ↑ Summary FastSOM.xs »