AI-ML

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

    "Rui Meira <ruimiguelcm96\@gmail.com>"
  ],
  "dist_name" => "AI-ML",
  "dist_version" => "0.001",
  "license" => "perl",
  "module_name" => "AI::ML",
  "recursive_test_files" => 1,
  "test_requires" => {
    "ExtUtils::MakeMaker" => 0,
    "File::Spec" => 0,
    "Test2::V0" => "0.000060",
    "Test::More" => 0
  }
);


my %fallback_build_requires = (
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => 0,
  "Module::Build" => "0.28",
  "Test2::V0" => "0.000060",
  "Test::More" => 0
);


unless ( eval { Module::Build->VERSION(0.4004) } ) {
  delete $module_build_args{test_requires};
  $module_build_args{build_requires} = \%fallback_build_requires;
}

my $build = MyBuilder->new(%module_build_args);

META.json  view on Meta::CPAN

      "configure" : {
         "requires" : {
            "Module::Build" : "0.28"
         }
      },
      "develop" : {
         "requires" : {
            "File::Spec" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Test::More" : "0",
            "Test::Pod" : "1.41"
         }
      },
      "test" : {
         "recommends" : {
            "CPAN::Meta" : "2.120900"
         },
         "requires" : {
            "ExtUtils::MakeMaker" : "0",
            "File::Spec" : "0",
            "Test2::V0" : "0.000060",
            "Test::More" : "0"
         }
      }
   },
   "provides" : {
      "AI::ML" : {
         "file" : "lib/AI/ML.pm",
         "version" : "0.001"
      },
      "AI::ML::Expr" : {
         "file" : "lib/AI/ML/Expr.pm",

META.json  view on Meta::CPAN

            "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
            "config" : {
               "Dist::Zilla::Role::FileWatcher" : {
                  "version" : "0.006"
               }
            },
            "name" : "@Starter/ReadmeAnyFromPod",
            "version" : "0.163250"
         },
         {
            "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
            "name" : "@Starter/PodSyntaxTests",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs",
            "name" : "@Starter/Test::ReportPrereqs",
            "version" : "0.027"
         },
         {
            "class" : "Dist::Zilla::Plugin::Test::Compile",
            "config" : {
               "Dist::Zilla::Plugin::Test::Compile" : {
                  "bail_out_on_fail" : 0,
                  "fail_on_warning" : "author",
                  "fake_home" : 0,
                  "filename" : "xt/author/00-compile.t",
                  "module_finder" : [
                     ":InstallModules"
                  ],
                  "needs_display" : 0,
                  "phase" : "develop",
                  "script_finder" : [
                     ":PerlExecFiles"
                  ],
                  "skips" : [],
                  "switch" : []
               }
            },
            "name" : "@Starter/Test::Compile",
            "version" : "2.058"
         },
         {
            "class" : "Dist::Zilla::Plugin::Manifest",
            "name" : "@Starter/Manifest",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::PruneCruft",
            "name" : "@Starter/PruneCruft",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::ManifestSkip",
            "name" : "@Starter/ManifestSkip",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::RunExtraTests",
            "config" : {
               "Dist::Zilla::Role::TestRunner" : {
                  "default_jobs" : 1
               }
            },
            "name" : "@Starter/RunExtraTests",
            "version" : "0.029"
         },
         {
            "class" : "Dist::Zilla::Plugin::TestRelease",
            "name" : "@Starter/TestRelease",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::ConfirmRelease",
            "name" : "@Starter/ConfirmRelease",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::UploadToCPAN",
            "name" : "@Starter/UploadToCPAN",

META.json  view on Meta::CPAN

            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::ExecDir",
            "name" : "@Starter/ExecDir",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::ModuleBuild",
            "config" : {
               "Dist::Zilla::Role::TestRunner" : {
                  "default_jobs" : 1
               }
            },
            "name" : "ModuleBuild",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::Prereqs",
            "config" : {
               "Dist::Zilla::Plugin::Prereqs" : {
                  "phase" : "test",
                  "type" : "requires"
               }
            },
            "name" : "TestRequires",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::Git::GatherDir",
            "config" : {
               "Dist::Zilla::Plugin::GatherDir" : {
                  "exclude_filename" : [],
                  "exclude_match" : [],
                  "follow_symlinks" : 0,
                  "include_dotfiles" : 0,

META.json  view on Meta::CPAN

            "name" : ":InstallModules",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":IncModules",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":TestFiles",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":ExtraTestFiles",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":ExecFiles",
            "version" : "6.010"
         },
         {
            "class" : "Dist::Zilla::Plugin::FinderCode",
            "name" : ":PerlExecFiles",

META.yml  view on Meta::CPAN

---
abstract: 'Perl interface to ML'
author:
  - 'Rui Meira <ruimiguelcm96@gmail.com>'
build_requires:
  ExtUtils::MakeMaker: '0'
  File::Spec: '0'
  Module::Build: '0.28'
  Test2::V0: '0.000060'
  Test::More: '0'
configure_requires:
  Module::Build: '0.28'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AI-ML
no_index:

META.yml  view on Meta::CPAN

      name: '@Starter/License'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::ReadmeAnyFromPod
      config:
        Dist::Zilla::Role::FileWatcher:
          version: '0.006'
      name: '@Starter/ReadmeAnyFromPod'
      version: '0.163250'
    -
      class: Dist::Zilla::Plugin::PodSyntaxTests
      name: '@Starter/PodSyntaxTests'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::Test::ReportPrereqs
      name: '@Starter/Test::ReportPrereqs'
      version: '0.027'
    -
      class: Dist::Zilla::Plugin::Test::Compile
      config:
        Dist::Zilla::Plugin::Test::Compile:
          bail_out_on_fail: '0'
          fail_on_warning: author
          fake_home: 0
          filename: xt/author/00-compile.t
          module_finder:
            - ':InstallModules'
          needs_display: 0
          phase: develop
          script_finder:
            - ':PerlExecFiles'
          skips: []
          switch: []
      name: '@Starter/Test::Compile'
      version: '2.058'
    -
      class: Dist::Zilla::Plugin::Manifest
      name: '@Starter/Manifest'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::PruneCruft
      name: '@Starter/PruneCruft'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::ManifestSkip
      name: '@Starter/ManifestSkip'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::RunExtraTests
      config:
        Dist::Zilla::Role::TestRunner:
          default_jobs: 1
      name: '@Starter/RunExtraTests'
      version: '0.029'
    -
      class: Dist::Zilla::Plugin::TestRelease
      name: '@Starter/TestRelease'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::ConfirmRelease
      name: '@Starter/ConfirmRelease'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::UploadToCPAN
      name: '@Starter/UploadToCPAN'
      version: '6.010'
    -

META.yml  view on Meta::CPAN

      class: Dist::Zilla::Plugin::ShareDir
      name: '@Starter/ShareDir'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::ExecDir
      name: '@Starter/ExecDir'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::ModuleBuild
      config:
        Dist::Zilla::Role::TestRunner:
          default_jobs: 1
      name: ModuleBuild
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::Prereqs
      config:
        Dist::Zilla::Plugin::Prereqs:
          phase: test
          type: requires
      name: TestRequires
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::Git::GatherDir
      config:
        Dist::Zilla::Plugin::GatherDir:
          exclude_filename: []
          exclude_match: []
          follow_symlinks: 0
          include_dotfiles: 0
          prefix: ''

META.yml  view on Meta::CPAN

    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':InstallModules'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':IncModules'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':TestFiles'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':ExtraTestFiles'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':ExecFiles'
      version: '6.010'
    -
      class: Dist::Zilla::Plugin::FinderCode
      name: ':PerlExecFiles'
      version: '6.010'
    -

dist.ini  view on Meta::CPAN

license = Perl_5
copyright_holder = Rui Meira
copyright_year   = 2018

version = 0.001

[@Starter]
-remove = MakeMaker
-remove = GatherDir

;[PodCoverageTests]

[ModuleBuild]
mb_class = MyBuilder

[Prereqs / TestRequires]
Test2::V0 = 0.000060

[Git::GatherDir]
exclude_mathc = ^_

t/00-report-prereqs.dd  view on Meta::CPAN

       'configure' => {
                        'requires' => {
                                        'Module::Build' => '0.28'
                                      }
                      },
       'develop' => {
                      'requires' => {
                                      'File::Spec' => '0',
                                      'IO::Handle' => '0',
                                      'IPC::Open3' => '0',
                                      'Test::More' => '0',
                                      'Test::Pod' => '1.41'
                                    }
                    },
       'test' => {
                   'recommends' => {
                                     'CPAN::Meta' => '2.120900'
                                   },
                   'requires' => {
                                   'ExtUtils::MakeMaker' => '0',
                                   'File::Spec' => '0',
                                   'Test2::V0' => '0.000060',
                                   'Test::More' => '0'
                                 }
                 }
     };
  $x;
 }

t/00-report-prereqs.t  view on Meta::CPAN

#!perl

use strict;
use warnings;

# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027

use Test::More tests => 1;

use ExtUtils::MakeMaker;
use File::Spec;

# from $version::LAX
my $lax_version_re =
    qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
            |
            (?:\.[0-9]+) (?:_[0-9]+)?
        ) | (?:

t/01-activation-funcs.t  view on Meta::CPAN

#!perl

use Test2::V0 qw'is float done_testing';
use Math::Lapack::Matrix;
use Math::Lapack::Expr;
use AI::ML::Expr;

use Data::Dumper;


my $m = Math::Lapack::Matrix->new(
				[ 
					[0, 0.002, 3, 4, 7.333, -.00008, -2.03456, 9, 100.3456, -300] 
				]
);

is($m->rows, 1, "Right number of rows");
is($m->columns, 10, "Right number of columns");

#Test Sigmoid
my $a = sigmoid($m);
_float($a->get_element(0,0), 0.5, "Element correct at 0,0");
_float($a->get_element(0,1), 5.005e-1, "Element correct at 0,1");
_float($a->get_element(0,2), 9.52574127e-001, "Element correct at 0,2");
_float($a->get_element(0,3), 9.82013790e-001, "Element correct at 0,3");
_float($a->get_element(0,4), 9.99346817e-001, "Element correct at 0,4");
_float($a->get_element(0,5), 4.99980000e-001, "Element correct at 0,5");
_float($a->get_element(0,6), 1.15621829e-001, "Element correct at 0,6");
_float($a->get_element(0,7), 9.99876605e-001, "Element correct at 0,7");
_float($a->get_element(0,8), 1, "Element correct at 0,8");
_float($a->get_element(0,9), 5.14820022e-131, "Element correct at 0,9");

#Test Derivative of Sigmoid
$a = d_sigmoid($m);
_float($a->get_element(0,0), 2.50000000e-001, "Element correct at 0,0");
_float($a->get_element(0,1), 2.49999750e-001, "Element correct at 0,1");
_float($a->get_element(0,2), 4.51766597e-002, "Element correct at 0,2");
_float($a->get_element(0,3), 1.76627062e-002, "Element correct at 0,3");
_float($a->get_element(0,4), 6.52756239e-004, "Element correct at 0,4");
_float($a->get_element(0,5), 2.50000000e-001, "Element correct at 0,5");
_float($a->get_element(0,6), 1.02253421e-001, "Element correct at 0,6");
_float($a->get_element(0,7), 1.23379350e-004, "Element correct at 0,7");
_float($a->get_element(0,8), 0, "Element correct at 0,8");
_float($a->get_element(0,9), 5.14820022e-131, "Element correct at 0,9");

#Test Relu
my $b = relu($m);
_float($b->get_element(0,0), 0, "Element correct at 0,0");
_float($b->get_element(0,1), 2.000000e-03, "Element correct at 0,1");
_float($b->get_element(0,2), 3, "Element correct at 0,2");
_float($b->get_element(0,3), 4, "Element correct at 0,3");
_float($b->get_element(0,4), 7.333000e+00, "Element correct at 0,4");
_float($b->get_element(0,5), 0, "Element correct at 0,5");
_float($b->get_element(0,6), 0, "Element correct at 0,6");
_float($b->get_element(0,7), 9, "Element correct at 0,7");
_float($b->get_element(0,8), 1.003456e+02, "Element correct at 0,8");
_float($b->get_element(0,9), 0, "Element correct at 0,9");

#Test derivative of Relu
$b = d_relu($m);
_float($b->get_element(0,0), 1, "Element correct at 0,0");
_float($b->get_element(0,1), 1, "Element correct at 0,1");
_float($b->get_element(0,2), 1, "Element correct at 0,2");
_float($b->get_element(0,3), 1, "Element correct at 0,3");
_float($b->get_element(0,4), 1, "Element correct at 0,4");
_float($b->get_element(0,5), 0, "Element correct at 0,5");
_float($b->get_element(0,6), 0, "Element correct at 0,6");
_float($b->get_element(0,7), 1, "Element correct at 0,7");
_float($b->get_element(0,8), 1, "Element correct at 0,8");
_float($b->get_element(0,9), 0, "Element correct at 0,9");

#Test leaky Relu
my $c = lrelu($m, .001);
_float($c->get_element(0,0), 0, "Element correct at 0,0");
_float($c->get_element(0,1), 2.000000e-03, "Element correct at 0,1");
_float($c->get_element(0,2), 3.000000e+00, "Element correct at 0,2");
_float($c->get_element(0,3), 4.000000e+00, "Element correct at 0,3");
_float($c->get_element(0,4), 7.333000e+00, "Element correct at 0,4");
_float($c->get_element(0,5), -8.000000e-08, "Element correct at 0,5");
_float($c->get_element(0,6), -2.034560e-03, "Element correct at 0,6");
_float($c->get_element(0,7), 9.000000e+00, "Element correct at 0,7");
_float($c->get_element(0,8), 1.003456e+02, "Element correct at 0,8");
_float($c->get_element(0,9), -3.000000e-01, "Element correct at 0,9");

#Test derivative of leaky Relu
$c = d_lrelu($m, .001);
_float($c->get_element(0,0), 1, "Element correct at 0,0");
_float($c->get_element(0,1), 1, "Element correct at 0,1");
_float($c->get_element(0,2), 1, "Element correct at 0,2");
_float($c->get_element(0,3), 1, "Element correct at 0,3");
_float($c->get_element(0,4), 1, "Element correct at 0,4");
_float($c->get_element(0,5), .001, "Element correct at 0,5");
_float($c->get_element(0,6), .001, "Element correct at 0,6");
_float($c->get_element(0,7), 1, "Element correct at 0,7");
_float($c->get_element(0,8), 1, "Element correct at 0,8");
_float($c->get_element(0,9), .001, "Element correct at 0,9");

# Test tanh
my $d = tanh($m);
_float($d->get_element(0,0), 0, "Element correct at 0,0");
_float($d->get_element(0,1), 1.99999733e-03, "Element correct at 0,1");
_float($d->get_element(0,2), 9.95054754e-01, "Element correct at 0,2");
_float($d->get_element(0,3), 9.99329300e-01, "Element correct at 0,3");
_float($d->get_element(0,4), 9.99999146e-01, "Element correct at 0,4");
_float($d->get_element(0,5), -7.99999998e-05, "Element correct at 0,5");
_float($d->get_element(0,6), -9.66389636e-01, "Element correct at 0,6");
_float($d->get_element(0,7), 9.99999970e-01, "Element correct at 0,7");
_float($d->get_element(0,8), 1, "Element correct at 0,8");
_float($d->get_element(0,9), -1, "Element correct at 0,9");

#Test derivative of tanh
$d = d_tanh($m);
_float($d->get_element(0,0), 1.00000000e+00, "Element correct at 0,0");
_float($d->get_element(0,1), 9.99996000e-01, "Element correct at 0,1");
_float($d->get_element(0,2), 9.86603717e-03, "Element correct at 0,2");
_float($d->get_element(0,3), 1.34095068e-03, "Element correct at 0,3");
_float($d->get_element(0,4), 1.70882169e-06, "Element correct at 0,4");
_float($d->get_element(0,5), 9.99999994e-01, "Element correct at 0,5");
_float($d->get_element(0,6), 6.60910712e-02, "Element correct at 0,6");
_float($d->get_element(0,7), 6.09199171e-08, "Element correct at 0,7");
_float($d->get_element(0,8), 0, "Element correct at 0,8");
_float($d->get_element(0,9), 0, "Element correct at 0,9");


# Test softmax
my $e =  Math::Lapack::Matrix->new(
               [
                [1, 2, 1],  # sample 1
                [2, 4, 2],  # sample 1
                [3, 5, 3],  # sample 2
                [6, 6, 6]
            ]);


my $soft = softmax($e);

t/02-cost_functions.t  view on Meta::CPAN

#!perl

use Math::Lapack::Matrix;
use Math::Lapack::Expr;
use AI::ML::Expr;

my $m_1 = Math::Lapack::Matrix->new([ [-2, 1, 2, 3] ]);
my $nr_tests = 0;

#Test d_relu
my $a = d_relu($m_1);

float($a->get_element(0,0), 0, "Element correct at 0,0");
float($a->get_element(0,1), 1, "Element correct at 0,1");
float($a->get_element(0,2), 1, "Element correct at 0,2");
float($a->get_element(0,3), 1, "Element correct at 0,3");

my $b = $a x $m_1->transpose;

float($b->get_element(0,0), 6, "Element correct at 0,0");

t/04-linear-regression.t  view on Meta::CPAN

#!perl

use Test2::V0;

use Math::Lapack::Matrix;
use AI::ML::LinearRegression;


my $x = Math::Lapack::Matrix->new([[12.39999962],[14.30000019],[14.5],[14.89999962],[16.10000038],[16.89999962],[16.5],[15.39999962],[17],[17.89999962],[18.79999924],[20.29999924],[22.39999962],[19.39999962],[15.5],[16.70000076],[17.29999924],[18.399...

my $y = Math::Lapack::Matrix->new([[11.19999981],[12.5],[12.69999981],[13.10000038],[14.10000038],[14.80000019],[14.39999962],[13.39999962],[14.89999962],[15.60000038],[16.39999962],[17.70000076],[19.60000038],[16.89999962],[14],[14.60000038],[15.100...

my $m = AI::ML::LinearRegression->new(plot => "../../plot.png");

t/05-logistic-regression.t  view on Meta::CPAN

#!perl

use Test2::V0 qw'is float done_testing';
use Math::Lapack::Matrix;
use Math::Lapack;
use AI::ML::LogisticRegression;

Math::Lapack->seed_rng(0);

my $x = Math::Lapack::Matrix::read_csv("t/logistic.csv", col_range =>[0,2]);
my $y = Math::Lapack::Matrix::read_csv("t/logistic.csv", col => 3);


t/07-neural-network.t  view on Meta::CPAN

#!perl

use Test2::V0 qw'is float done_testing';
use Math::Lapack::Matrix;
use AI::ML::NeuralNetwork;
use Math::Lapack;
use Data::Dumper;


Math::Lapack->seed_rng(0);

my $x = Math::Lapack::Matrix::read_csv("t/x.csv");
my $y = Math::Lapack::Matrix::read_csv("t/y.csv");

t/08-gradient-checking.t_  view on Meta::CPAN

#!perl

use Test2::V0 qw'is float done_testing';
use Math::Lapack::Matrix;
use AI::ML::NeuralNetwork;
use Math::Lapack;
use Data::Dumper;


Math::Lapack->seed_rng(0);

#my $x = Math::Lapack::Matrix::read_csv("t/logistic.csv", col_range =>[0,2]);
#my $y = Math::Lapack::Matrix::read_csv("t/logistic.csv", col => 3);

xt/author/00-compile.t  view on Meta::CPAN

use 5.006;
use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058

use Test::More;

plan tests => 6;

my @module_files = (
    'AI/ML.pm',
    'AI/ML/Expr.pm',
    'AI/ML/LinearRegression.pm',
    'AI/ML/LogisticRegression.pm',
    'AI/ML/NeuralNetwork.pm'
);

xt/author/00-compile.t  view on Meta::CPAN

    if (@_warnings)
    {
        warn @_warnings;
        push @warnings, @_warnings;
    }
}



is(scalar(@warnings), 0, 'no warnings found')
    or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) );


xt/author/pod-syntax.t  view on Meta::CPAN

#!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;

all_pod_files_ok();



( run in 0.749 second using v1.01-cache-2.11-cpan-a5abf4f5562 )