| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||