This is ffnet-0.7 README file.
Distributed under the terms of the GNU General Public License (GPL)
Copyright (C) 2011 by Marek Wojciechowski
ffnet is a fast and easy-to-use feed-forward neural network
training solution for python. For usage examples
go to http://ffnet.sourceforge.net or browse source distribution of
ffnet needs at least:
* python-2.6 (or 2.4, 2.5 + multiprocessing package)
For plots (which appear in examples) you'll need also the
matplotlib package (http://matplotlib.sourceforge.net/).
If you're going to compile ffnet from sources you'll need also
python header files and C and Fortran 77 compiler.
Installation of those depends on your operating system.
Go to http://ffnet.sourceforge.net to download latest release version
of ffnet. You can also download development version from ffnet
subversion repository (you need subversion installed on your system):
svn co https://ffnet.svn.sourceforge.net/svnroot/ffnet/trunk ffnet
In order to grab the latest development snapshot via your web browser go to
and download the tarball.
Be aware that development versions are not guaranteed to be fully functional.
For building from sources you can try:
If this doesn't work for you (for example you don't have setuptools installed)
you can try the options below:
1. Building from source on Linux/Unix.
Unpack ffnet to the directory of your choice, enter this
directory and run as root:
python setup.py install
ffnet uses numpy.distutils and f2py tool to compile Fortran parts of
the program. The above will work if you are running Linux/Unix system
with gcc and g77 (gfortran). If you need to use another compiler run:
f2py -c --help-fcompiler
to see a list of supported compilers.
For example, installing with Intel Fortran Compiler on 32-bit machine
python setup.py install --fcompiler=intel
2. Binary packages for Linux/Unix
You are welcome to produce binary packages for your Linux distribution.
3. Building from source on Windows (32-bit).
If you have mingw compilers installed, run:
python setup.py build --compiler=mingw32
python setup.py install --skip-build
4. Binary installers for Windows:
You are welcome to produce binary packages for Windows.
Installation can be tested with:
from ffnet._tests import runtest
Execute also ffnet examples. They all should work.
>>> from ffnet import ffnet, mlgraph, savenet, loadnet, exportnet
>>> conec = mlgraph( (2,2,1) )
>>> net = ffnet(conec)
>>> input = [ [0.,0.], [0.,1.], [1.,0.], [1.,1.] ]
>>> target = [ [1.], [0.], [0.], [1.] ]
>>> net.train_tnc(input, target, maxfun = 1000)
>>> net.test(input, target, iprint = 2)
>>> savenet(net, "xor.net")
>>> exportnet(net, "xor.f")
>>> net = loadnet("xor.net")
>>> answer = net( [ 0., 0. ] )
>>> partial_derivatives = net.derivative( [ 0., 0. ] )
Windows users might be interested in installing Enthought Python Distribution:
which reaches all ffnet requirements and is free for non-commercial use.
It is also very convenient to use ffnet interactively with
ipython, an enhanced python shell. See http://ipython.scipy.org/moin.