AI-Perceptron-Simple
view release on metacpan or search on metacpan
"requires" : {
"Carp" : "0",
"File::Basename" : "0",
"List::Util" : "0",
"Storable" : "0",
"Text::CSV" : "2.01",
"Text::Matrix" : "1.00",
"YAML" : "0",
"local::lib" : "0",
"perl" : "5.008001",
"utf8" : "0"
}
},
"test" : {
"requires" : {
"FindBin" : "0",
"Test::More" : "0",
"Test::Output" : "1.033"
}
}
},
requires:
Carp: '0'
File::Basename: '0'
List::Util: '0'
Storable: '0'
Text::CSV: '2.01'
Text::Matrix: '1.00'
YAML: '0'
local::lib: '0'
perl: '5.008001'
utf8: '0'
version: '1.04'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
Makefile.PL view on Meta::CPAN
MIN_PERL_VERSION => '5.008001',
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => '0',
},
TEST_REQUIRES => {
'Test::More' => '0',
'Test::Output' => '1.033',
'FindBin' => '0',
},
PREREQ_PM => {
'utf8' => '0',
'local::lib' => '0',
'Carp' => '0',
'Storable' => '0',
'Text::CSV' => '2.01',
'Text::Matrix' => '1.00',
'YAML' => '0',
'File::Basename' => '0',
'List::Util' => '0',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
docs/AI-Perceptron-Simple-1.04.html view on Meta::CPAN
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#VERSION">VERSION</a></li>
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
package AI::Perceptron::Simple;
use 5.008001;
use strict;
use warnings;
use Carp "croak";
use utf8;
binmode STDOUT, ":utf8";
require local::lib; # no local::lib in tests, this is also to avoid loading local::lib multiple times
use Text::CSV qw( csv );
use Text::Matrix;
use File::Basename qw( basename );
use List::Util qw( shuffle );
=head1 NAME
AI::Perceptron::Simple
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
sub shuffle_data {
my $stimuli = shift or croak "Please specify the original file name";
my @shuffled_stimuli_names = @_
or croak "Please specify the output files for the shuffled data";
my @aoa;
for ( @shuffled_stimuli_names ) {
# copied from _real_validate_or_test
# open for shuffling
my $aoa = csv (in => $stimuli, encoding => ":encoding(utf-8)");
my $attrib_array_ref = shift @$aoa; # 'remove' the header, it's annoying :)
@aoa = shuffle( @$aoa ); # this can only process actual array
unshift @aoa, $attrib_array_ref; # put back the headers before saving file
csv( in => \@aoa, out => $_, encoding => ":encoding(utf-8)" )
and
print "Saved shuffled data into ", basename($_), "!\n";
}
}
=head1 CREATION RELATED SUBROUTINES/METHODS
=head2 new ( \%options )
lib/AI/Perceptron/Simple.pm view on Meta::CPAN
my $stimuli_validate = $data_hash_ref->{ stimuli_validate };
my $predicted_index = $data_hash_ref->{ predicted_column_index };
# actual processing starts here
my $output_file = defined $data_hash_ref->{ results_write_to }
? $data_hash_ref->{ results_write_to }
: $stimuli_validate;
# open for writing results
my $aoa = csv (in => $stimuli_validate, encoding => ":encoding(utf-8)");
my $attrib_array_ref = shift @$aoa; # 'remove' the header, it's annoying :)
$aoa = _fill_predicted_values( $self, $stimuli_validate, $predicted_index, $aoa );
# put back the array of headers before saving file
unshift @$aoa, $attrib_array_ref;
print "Saving data to $output_file\n";
csv( in => $aoa, out => $output_file, encoding => ":encoding(utf-8)" );
print "Done saving!\n";
}
=head2 &_fill_predicted_values ( $self, $stimuli_validate, $predicted_index, $aoa )
This is where the filling in of the predicted values takes place. Take note that the parameters naming are the same as the ones used in the C<validate> and C<test> method.
This subroutine should be called in the procedural way.
( run in 0.266 second using v1.01-cache-2.11-cpan-a5abf4f5562 )