Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ANNOUNCE] AI::FANN

20 views
Skip to first unread message

sfan...@yahoo.com

unread,
Apr 14, 2006, 6:50:56 AM4/14/06
to per...@perl.org
Hi,

I have uploaded the new AI::FANN module to CPAN:

http://search.cpan.org/~salva/AI-FANN/

It is a wrapper for the Fast Artificial Neural Network library
(http://fann.sf.net):

Fast Artificial Neural Network Library is a free open source
neural network library, which implements multilayer artificial
neural networks in C with support for both fully connected and
sparsely connected networks. Cross-platform execution in both
fixed and floating point are supported. It includes a framework
for easy handling of training data sets. It is easy to use,
versatile, well documented, and fast. PHP, C++, .NET, Python,
Delphi, Octave, Ruby, Pure Data and Mathematica bindings are
available. A reference manual accompanies the library with
examples and recommendations on how to use the library. A
graphical user interface is also available for the library.

This is an early release that may contain critical bugs, though
most things seem to be working properly.

The documentation focus on the differences with the C library, and
both versions should be consulted in order to use the module.

Training an ANN to emulate a XOR gate with AI::FANN looks like
that:

use AI::FANN qw(:all);

# create an ANN with 2 inputs, a hidden layer with 3 neurons
# and an output layer with 1 neuron:
my $ann = AI::FANN->new_standard(2, 3, 1);

$ann->hidden_activation_function(FANN_SIGMOID_SYMMETRIC);
$ann->output_activation_function(FANN_SIGMOID_SYMMETRIC);

# create the training data for a XOR operator:
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, 1000, 0.001);

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


And using the trained ANN:

use AI::FANN;

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];
}
}

Comments and feedback are very welcome!

Cheers,

- Salva.

Ovid

unread,
Apr 14, 2006, 12:26:33 PM4/14/06
to Salvador Fandi�o, per...@perl.org
--- Salvador Fandi�o <sfan...@yahoo.com> wrote:

> Hi,
>
> I have uploaded the new AI::FANN module to CPAN:
>
> http://search.cpan.org/~salva/AI-FANN/

Looks great (from the docs, haven't tested it).

I think these are a typos:

FANN::AI->new_standard(@layer_sizes)
FANN::AI->new_sparse($connection_rate, @layer_sizes)
FANN::AI->new_shortcut(@layer_sizes)
FANN::AI->new_from_file($filename)

Cheers,
Ovid

--
If this message is a response to a question on a mailing list, please send follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

Salvador Fandiño)

unread,
Apr 14, 2006, 1:51:08 PM4/14/06
to publiuste...@yahoo.com, per...@perl.org

--- Ovid <publiuste...@yahoo.com> wrote:

> I think these are a typos:
>
> FANN::AI->new_standard(@layer_sizes)
> FANN::AI->new_sparse($connection_rate, @layer_sizes)
> FANN::AI->new_shortcut(@layer_sizes)
> FANN::AI->new_from_file($filename)

oh, yes, thank you for pointing them.

Cheers,

- Salva


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

0 new messages