Incorrect search filter: invalid characters - *.p[ml]
AI-FANN

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - add support for FANN_SIN_SYMMETRIC, FANN_COS_SYMMETRIC,
      FANN_SIN and FANN_COS constants.

0.07 Nov 22, 2006
    - move to FANN 2.1

0.06 Sep 18, 2006
    - add support for FANN_LIB and FANN_INCLUDE to MAkefile.PL

0.05 May 4, 2006
    - ppport.h regenerated with latest version of Devel::PPPort to
      make it work on perls older than 5.8.8 (bug reported by bodyn).

0.04 May 1, 2006
    - corrected bug on accessor generators with indexes
    - better accessor generation using default arguments XS feature

0.03 Apr 14, 2006
    - improved docs.

0.02 Apr 14, 2006

FANN.xs  view on Meta::CPAN


void
fann_train(self, input, desired_output)
    struct fann *self;
    fta_input input;
    fta_output desired_output;
  CLEANUP:
    _check_error(aTHX_ (struct fann_error *)self);

fta_output
fann_test(self, input, desired_output)
    struct fann *self;
    fta_input input;
    fta_output desired_output;
  CLEANUP:
    _check_error(aTHX_ (struct fann_error *)self);

void
fann_reset_MSE(self)
    struct fann * self;
  CLEANUP:

README  view on Meta::CPAN

=======

This module provides a Perl wrapper for the FANN library
(http://fann.sf.net).

DEPENDENCIES

This module requires the FANN library version 2.1.0beta or later
compiled to use doubles internally.

The module Test::More is also required for testing.


INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

You may need to add two extra parameters to the Makefile.PL script to
indicate where to find the FANN library and include files if they are
not installed on some standard locations. For instance:

   perl Makefile.PL                            \
       FANN_LIB=/usr/local/fann/lib            \
       FANN_INCLUDE=/usr/local/fann/include

lib/AI/FANN.pm  view on Meta::CPAN


  $out = $ann->run([1, 0.6]);
  print "@$out\n";

=item $ann->randomize_weights($min_weight, $max_weight)

=item $ann->train($input, $desired_output)

C<$input> and C<$desired_output> are arrays.

=item $ann->test($input, $desired_output)

C<$input> and C<$desired_output> are arrays.

It returns an array with the values of the output layer.

=item $ann->reset_MSE

-

=item $ann->train_on_file($filename, $max_epochs, $epochs_between_reports, $desired_error)

lib/AI/FANN.pm  view on Meta::CPAN

-

=back

=head1 INSTALLATION

See the README file for instruction on installing this module.

=head1 BUGS

Only tested on Linux.

I/O is not performed through PerlIO because the C library doesn't have
the required infrastructure to do that.

Send bug reports to my email address or use the CPAN RT system.

=head1 SEE ALSO

FANN homepage at L<http://leenissen.dk/fann/index.php>.

ppport.h  view on Meta::CPAN

  --strip                     strip all script and doc functionality from
                              ppport.h

  --list-provided             list provided API
  --list-unsupported          list unsupported API
  --api-info=name             show Perl API portability information

=head1 COMPATIBILITY

This version of F<ppport.h> is designed to support operation with Perl
installations back to 5.003, and has been tested up to 5.10.0.

=head1 OPTIONS

=head2 --help

Display a brief usage summary.

=head2 --version

Display the version of F<ppport.h>.

ppport.h  view on Meta::CPAN


The result will usually be a list of patches suggesting changes
that should at least be acceptable, if not necessarily the most
efficient solution, or a fix for all possible problems.

If you know that your XS module uses features only available in
newer Perl releases, if you're aware that it uses C++ comments,
and if you want all suggestions as a single patch file, you could
use something like this:

    perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff

If you only want your code to be scanned without any suggestions
for changes, use:

    perl ppport.h --nochanges

You can specify a different C<diff> program or options, using
the C<--diff> option:

    perl ppport.h --diff='diff -C 10'

ppport.h  view on Meta::CPAN


to display information for all known API elements.

=head1 BUGS

If this version of F<ppport.h> is causing failure during
the compilation of this module, please check if newer versions
of either this module or C<Devel::PPPort> are available on CPAN
before sending a bug report.

If F<ppport.h> was generated using the latest version of
C<Devel::PPPort> and is causing failure of this module, please
file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.

Please include the following information:

=over 4

=item 1.

The complete output from running "perl -V"

ppport.h  view on Meta::CPAN

=item 4.

A full log of the build that failed.

=item 5.

Any other information that you think could be relevant.

=back

For the latest version of this code, please get the C<Devel::PPPort>
module from CPAN.

=head1 COPYRIGHT

Version 3.x, Copyright (c) 2004-2007, Marcus Holland-Moritz.

Version 2.x, Copyright (C) 2001, Paul Marquess.

Version 1.x, Copyright (C) 1999, Kenneth Albanowski.

ppport.h  view on Meta::CPAN


  if (s == send)
    return 0;

  /* next must be digit or the radix separator or beginning of infinity */
  if (isDIGIT(*s)) {
    /* UVs are at least 32 bits, so the first 9 decimal digits cannot
       overflow.  */
    UV value = *s - '0';
    /* This construction seems to be more optimiser friendly.
       (without it gcc does the isDIGIT test and the *s - '0' separately)
       With it gcc on arm is managing 6 instructions (6 cycles) per digit.
       In theory the optimiser could deduce how far to unroll the loop
       before checking for overflow.  */
    if (++s < send) {
      int digit = *s - '0';
      if (digit >= 0 && digit <= 9) {
        value = value * 10 + digit;
        if (++s < send) {
          digit = *s - '0';
          if (digit >= 0 && digit <= 9) {

samples/add.pl  view on Meta::CPAN

        my $a = rand(2) - 1;
        my $b = rand(2) - 1;
        my $c = 0.5 * ($a + $b);

        $train->data($_, [$a, $b], [$c]);
    }

    $ann->train_on_data($train, 25000, 250, 0.00001);
    $ann->save("add.ann");
}
elsif ($ARGV[0] eq 'test') {

    my $ann = AI::FANN->new_from_file("add.ann");

    for (1..10) {
        my $a = rand(2) - 1;
        my $b = rand(2) - 1;

        my $c = 0.5 * ($a + $b);

        my $out = $ann->run([$a, $b]);

samples/ox.pl  view on Meta::CPAN

    print "\n";
    my $ann = AI::FANN->new_standard(@_);
    for (1..40) {
        $ann->train_on_data($train, 100, 1, 0.0001);
        # $ann->print_connections;
        $ann->print_parameters;
        $ann->save("ox.ann");
    }
}

sub make_test {
    my $rep = shift;
    my $ann = AI::FANN->new_from_file("ox.ann");
    print "ann read\n";
    for (0..$rep - 1) {
        my $im = GD::Image->new($size, $size);
        my $white = $im->colorAllocate(255,255,255);
        my $black = $im->colorAllocate(0,0,0);
        my $type = (rand > .5);
        my $r = $type ? draw_x($im, $black) : draw_o($im, $black);
        my $out = $ann->run(image_to_input($im));
        printf ("type: %f, r: %4.2f out type: %f, r: %4.2f\n", $type, $r, $out->[0], $out->[1]);
    }
}

if ($ARGV[0] eq 'train') {
    make_train($size * $size, 4 * $size * $size, 240, 200, 60, 20, 2);
}
elsif ($ARGV[0] eq 'test') {
    make_test($ARGV[1] || 10);
}
else {
    die "wrong action"
}

samples/xor.pl  view on Meta::CPAN

    my $xor_train = AI::FANN::TrainData->new( [-1, -1], [-1],
                                              [-1, 1], [1],
                                              [1, -1], [1],
                                              [1, 1], [-1] );

    $ann->train_on_data($xor_train, 500000, 100, 0.0001);

    $ann->save("xor.ann");

}
elsif ($ARGV[0] eq 'test') {

    my $ann = AI::FANN->new_from_file("xor.ann");

    for my $a (-1, 1) {
        for my $b (-1, 1) {
            my $out = $ann->run([$a, $b]);
            printf "xor(%f, %f) = %f\n", $a, $b, $out->[0];
        }
    }

t/AI-FANN.t  view on Meta::CPAN

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl AI-FANN.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 1;
BEGIN { use_ok('AI::FANN') };

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

t/pods.t  view on Meta::CPAN

#!/usr/bin/perl

use strict;
use Test::More;

plan skip_all => "Only the author needs to check that POD docs are right"
    unless eval "no warnings; getlogin eq 'salva'";

eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;

all_pod_files_ok( all_pod_files( qw(blib) ) );



( run in 0.348 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )