[Haskell-cafe] ANNOUNCE: hfann-01

Olivier Boudry olivier.boudry at gmail.com
Mon Jun 9 11:25:22 EDT 2008


Hi all,

I'm pleased to announce the first release of the hfann module (
http://code.haskell.org/~oboudry/hfann/). This module is an interface to the
"Fast Artificial Neural Network (FANN)" library (see
http://leenissen.dk/fann/).

This is an early release. At the moment the hfann module does not cover all
the functions found in the FANN library but it should be useable to train
and use simple Neural Networks. At least is can be used to run an equivalent
of the "Getting Started" example found in
http://leenissen.dk/fann/html/files2/gettingstarted-txt.html.

The module was developped on Windows XP with GHC-6.8.2.

The README should provide you with all required information to install this
module. The haddock documentation should give enough information to get
started using it.

== Installation ==

Download version 2.0 of the FANN library from:

    http://leenissen.dk/fann/download.php

and build it according to the instruction found on:

    http://leenissen.dk/fann/html/files2/installation-txt.html

Get the hfann module

    darcs get http://code.haskell.org/~oboudry/hfann/

Build it using Cabal

    runghc Setup.lhs configure
    runghc Setup.lhs build
    runghc Setup.lhs haddock
    runghc Setup.lhs install

== Examples ==

Training an ANN to the xor function:

> import HFANN

> main = do
>   withStandardFann [2,3,1] $ \fann -> do
>     setActivationFunctionHidden fann fannSigmoidSymetric
>     setActivationFunctionOutput fann fannSigmoidSymetric

>     trainOnFile fann "xor.data" -- train data
>                      20000      -- max epochs
>                      100        -- epochs between reports
>                      0.001      -- desired error

>     saveFann fann "xor.ann"

C:\Temp\Haskell\hfann\examples\xor>Train.exe
Max epochs    20000. Desired error: 0.0010000000.
Epochs            1. Current error: 0.2503675520. Bit fail 4.
Epochs          100. Current error: 0.0181358512. Bit fail 0.
Epochs          169. Current error: 0.0009599295. Bit fail 0.


Using the trained ANN on the 4 possible input values to the xor function (-1
= False, 1 = True).

> import HFANN

> main = do
>   withSavedFann "xor.ann" $ \fann -> do
>     mapM_ (\x -> runFann fann x >>= print) [[-1,-1],[-1,1],[1,-1],[1,1]]

C:\Temp\Haskell\hfann\examples\xor>Use.exe
[-0.950566361876292]
[0.9178714756661263]
[0.9457588340834527]
[-0.9482816646878051]

The "xor.data" training data content:
4 2 1
-1 -1
-1
-1 1
1
1 -1
1
1 1
-1

The files for this example can be found in the "examples/xor" directory

==

Bug reports, suggestions and comments are welcome. You can send them
directly to my e-mail address.

Olivier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080609/d1a52cb7/attachment.htm


More information about the Haskell-Cafe mailing list