AI-LibNeural

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may opt to apply the terms of the ordinary GNU General Public

LICENSE  view on Meta::CPAN

license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to

LICENSE  view on Meta::CPAN

LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

		     END OF TERMS AND CONDITIONS

           How to Apply These Terms to Your New Libraries

  If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change.  You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

  To apply these terms, attach the following notices to the library.  It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

README  view on Meta::CPAN

network. It isn't packed with features or a speed demon, but it works and it's
easy to learn how to use.

INSTALLATION

> perl Makefile.PL
or 
> perl Makefile.PL PREFIX=/some/non/system/place
(then setting PERL5LIB as appropriate based on ^ is a good ideal)
ignore the warnings about CC and LD being unknown parameters, then
> make all test install

Provided that everything goes well this should build the module, test it out,
and install it. If you encounter problems try e-mailing the author with as
much detail as possible. System type, os version, perl version, libneural
version, cpp compiler, script of the failing Makefile creation and compile
process.

USE

For information on using this library see the POD within AI::LibNeural.pm by
typing 'perldoc LibNeural.pm' in the same directory as this README or by
typing 'perldoc AI::LibNeural' after installtion.

DEPENDENCIES

libneural v1.0.3 or newer (it may work with older versions, but they have not
been tested.)

COPYRIGHT AND LICENCE

Copyright (C) 2003 by Ross McFarland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

t/00.AILibNeural.t  view on Meta::CPAN

# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the 
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
# Boston, MA  02111-1307  USA.
#

#########################
use strict;

use Test::More tests => 31;
BEGIN { use_ok('AI::LibNeural', ':all') };
#########################

my $nn;
ok( $nn = AI::LibNeural->new( 2, 4, 1 ) );
ok( $nn =~ m/AI::LibNeural=SCALAR(.*)/ );
ok( ALL == 0 );
ok( INPUT == 1 );
ok( HIDDEN == 2 );
ok( OUTPUT == 3 );

t/00.AILibNeural.t  view on Meta::CPAN

	$nn->train( [ 0, 0 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 0, 1 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 1, 0 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 1, 1 ], [ 0.95 ], 0.0000000005, 0.2 );
}
ok(1);
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );
ok( $nn->save('test.mem') );

$nn = undef;
ok( $nn = AI::LibNeural->new() );
ok( $nn =~ m/AI::LibNeural=SCALAR(.*)/ );
ok( $nn->load('test.mem') );
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );

$nn = undef;
ok( $nn = AI::LibNeural->new('test.mem') );
ok( $nn =~ m/AI::LibNeural=SCALAR(.*)/ );
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );
unlink('test.mem') if( -e 'test.mem' );

ok(1);

t/01.AILibNeuralChild.t  view on Meta::CPAN

# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the 
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
# Boston, MA  02111-1307  USA.
#

#########################
use strict;

use Test::More tests => 31;
BEGIN { use_ok('AI::LibNeural', ':all') };
#########################

package AI::LibNeural::Child;

our @ISA = qw(AI::LibNeural);

package main;

my $nn;

t/01.AILibNeuralChild.t  view on Meta::CPAN

	$nn->train( [ 0, 0 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 0, 1 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 1, 0 ], [ 0.05 ], 0.0000000005, 0.2 );
	$nn->train( [ 1, 1 ], [ 0.95 ], 0.0000000005, 0.2 );
}
ok(1);
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );
ok( $nn->save('test.mem') );

$nn = undef;
ok( $nn = AI::LibNeural::Child->new() );
ok( $nn =~ m/AI::LibNeural::Child=SCALAR(.*)/ );
ok( $nn->load('test.mem') );
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );

$nn = undef;
ok( $nn = AI::LibNeural::Child->new('test.mem') );
ok( $nn =~ m/AI::LibNeural::Child=SCALAR(.*)/ );
ok( $nn->run( [ 0, 0 ] ) < 0.5 );
ok( $nn->run( [ 0, 1 ] ) < 0.5 );
ok( $nn->run( [ 1, 0 ] ) < 0.5 );
ok( $nn->run( [ 1, 1 ] ) > 0.5 );
unlink('test.mem') if( -e 'test.mem' );

ok(1)



( run in 0.329 second using v1.01-cache-2.11-cpan-87723dcf8b7 )