AI-NNFlex
view release on metacpan or search on metacpan
lib/AI/NNFlex.pm view on Meta::CPAN
use strict;
use vars qw ($VERSION);
#use warnings;
###############################################################################
# NNFlex - Neural Network (flexible) - a heavily custom NN simulator
#
# Sept 2004 - CW Colbourn
#
# This was developed from the abortive nnseq package originally intended
# for real time neural networks.
# The basis of the approach for this version is a very flexible, modular
# set of packages. This package constitutes the base, allowing the modeller
# to create meshes, apply input, and read output ONLY!
#
# Separate modules are to be written to perform feedback adjustments,
# various activation functions, text/gui front ends etc
#
###############################################################################
# Version Control
# ===============
#
# 0.1 20040905 CColbourn New module
# added NNFlex::datasets
#
# 0.11 20050113 CColbourn Added NNFlex::lesion
# Improved Draw
# added NNFlex::datasets
#
# 0.12 20050116 CColbourn Fixed reinforce.pm bug
# Added call into datasets
# in ::run to offer alternative
# syntax
#
# 0.13 20050121 CColbourn Created momentum learning module
#
# 0.14 20050201 CColbourn Abstracted derivatiive of activation
# function into a separate function call
# instead of hardcoded 1-y*y in backprop
# tanh, linear & momentum
#
# 0.15 20050206 CColbourn Fixed a bug in feedforward.pm. Stopped
# calling dbug unless scalar debug > 0
# in a lot of calls
#
# 0.16 20050218 CColbourn Changed from a hash of weights to an
# array of weights, to make it easier
# to adapt the code to PDL
#
# 0.17 20050302 CColbourn Changed input params to ::output to
# be param=>parameter not anon hash
# Included round parameter in output
#
# 0.20 20050307 CColbourn Modified for inheritance to simplify
# future network types
#
# 0.21 20050316 CColbourn Rewrote perldocs, implemented fahlman
# constant, chopped out old legacy stuff
# put math functions in mathlib, etc etc
#
# 0.22 20050317 CColbourn Implemented ::connect method
#
# 0.23 20050424 CColbourn Included Hopfield module in dist.
#
# 0.24 20050620 CColbourn Corrected a bug in the bias weight
# calculation
#
#
###############################################################################
# ToDo
# ====
#
# Modify init to allow recurrent layer/node connections
# write cmd & gui frontends
# Speed the bugger up!
#
# Odd thought - careful coding of a network would allow grafting of
# two different network types or learning algorithms, like an effectve
# single network with 2 layers unsupervised and 2 layers supervised
#
# Clean up the perldocs
#
###############################################################################
$VERSION = "0.24";
###############################################################################
my @DEBUG; # a single, solitary, shameful global variable. Couldn't
#avoid it really. It allows correct control of debug
#information before the $network object is created
# (in ::layer->new & ::node->new for example).
lib/AI/NNFlex.pm view on Meta::CPAN
Weight assignments for the connection are calculated based on the network wide weight policy (see INIT).
=head3 lesion
$network->lesion (nodes=>PROBABILITY,connections=>PROBABILITY)
Damages the network.
B<PROBABILITY>
A value between 0 and 1, denoting the probability of a given node or connection being damaged.
Note: this method may be called on a per network, per node or per layer basis using the appropriate object.
=head1 EXAMPLES
See the code in ./examples. For any given version of NNFlex, xor.pl will contain the latest functionality.
=head1 PREREQs
None. NNFlex should run OK on any version of Perl 5 >.
=head1 ACKNOWLEDGEMENTS
Phil Brierley, for his excellent free java code, that solved my backprop problem
Dr Martin Le Voi, for help with concepts of NN in the early stages
Dr David Plaut, for help with the project that this code was originally intended for.
Graciliano M.Passos for suggestions & improved code (see SEE ALSO).
Dr Scott Fahlman, whose very readable paper 'An empirical study of learning speed in backpropagation networks' (1988) has driven many of the improvements made so far.
=head1 SEE ALSO
AI::NNFlex::Backprop
AI::NNFlex::Feedforward
AI::NNFlex::Mathlib
AI::NNFlex::Dataset
AI::NNEasy - Developed by Graciliano M.Passos
(Shares some common code with NNFlex)
=head1 TODO
Lots of things:
clean up the perldocs some more
write gamma modules
write BPTT modules
write a perceptron learning module
speed it up
write a tk gui
=head1 CHANGES
v0.11 introduces the lesion method, png support in the draw module and datasets.
v0.12 fixes a bug in reinforce.pm & adds a reflector in feedforward->run to make $network->run($dataset) work.
v0.13 introduces the momentum learning algorithm and fixes a bug that allowed training to proceed even if the node activation function module can't be loaded
v0.14 fixes momentum and backprop so they are no longer nailed to tanh hidden units only.
v0.15 fixes a bug in feedforward, and reduces the debug overhead
v0.16 changes some underlying addressing of weights, to simplify and speed
v0.17 is a bugfix release, plus some cleaning of UI
v0.20 changes AI::NNFlex to be a base class, and ships three different network types (i.e. training algorithms). Backprop & momentum are both networks of the feedforward class, and inherit their 'run' method from feedforward.pm. 0.20 also fixes a who...
v0.21 cleans up the perldocs more, and makes nnflex more distinctly a base module. There are quite a number of changes in Backprop in the v0.21 distribution.
v0.22 introduces the ::connect method, to allow creation of recurrent connections, and manual control over connections between nodes/layers.
v0.23 includes a Hopfield module in the distribution.
v0.24 fixes a bug in the bias weight calculations
=head1 COPYRIGHT
Copyright (c) 2004-2005 Charles Colbourn. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=head1 CONTACT
charlesc@nnflex.g0n.net
=cut
( run in 1.131 second using v1.01-cache-2.11-cpan-39bf76dae61 )