This is ffnet-0.6 README file.
Distributed under the terms of the GNU General Public License (GPL)
Copyright (C) 2007 by Marek Wojciechowski
ffnet is a fast and easy-to-use feed-forward neural network
training solution for python. For documentation and usage examples
go to http://ffnet.sourceforge.net or browse source distribution of
ffnet needs at least:
For plots (which appear in examples) you'll need also the
matplotlib package (http://matplotlib.sourceforge.net/). For
plotting the network architecture graphviz library and pygraphviz
or pydot wrappers are useful (but are not necessary).
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 (for example
on Ubuntu Linux you need 'python-dev', 'gcc' and 'g77' or 'gfortran').
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:
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 distributions.
I will publish them on ffnet download page.
3. Building from source on Windows.
If you have mingw compilers installed, run:
python setup.py build --compiler=mingw32
python setup.py install --skip-build
To install mingw download:
Don't forget to check g77 to be installed and remember to add
C:\MinGW\bin directory to system variable Path.
Note that python installation directory should also be in Path.
4. Binary installers for Windows:
Double click the installation program.
Attention: Binary packages work only for python versions indicated by installer name.
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.