Hi all,<br><br>I&#39;m pleased to announce the first release of the hfann module (<a href="http://code.haskell.org/~oboudry/hfann/">http://code.haskell.org/~oboudry/hfann/</a>). This module is an interface to the &quot;Fast Artificial Neural Network (FANN)&quot; library (see <a href="http://leenissen.dk/fann/">http://leenissen.dk/fann/</a>).<br>
<br>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 &quot;Getting Started&quot; example found in <a href="http://leenissen.dk/fann/html/files2/gettingstarted-txt.html">http://leenissen.dk/fann/html/files2/gettingstarted-txt.html</a>.<br>
<br>The module was developped on Windows XP with GHC-6.8.2.<br>
<br>
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.<br><br>== Installation ==<br><br>Download version 2.0 of the FANN library from:<br>
<br>&nbsp;&nbsp;&nbsp; <a href="http://leenissen.dk/fann/download.php">http://leenissen.dk/fann/download.php</a><br>&nbsp;&nbsp;&nbsp; <br>and build it according to the instruction found on:<br><br>&nbsp;&nbsp;&nbsp; <a href="http://leenissen.dk/fann/html/files2/installation-txt.html">http://leenissen.dk/fann/html/files2/installation-txt.html</a><br>
<br>Get the hfann module<br><br>&nbsp;&nbsp;&nbsp; darcs get <a href="http://code.haskell.org/~oboudry/hfann/">http://code.haskell.org/~oboudry/hfann/</a><br><br>Build it using Cabal<br><br>&nbsp;&nbsp;&nbsp; runghc Setup.lhs configure<br>&nbsp;&nbsp;&nbsp; runghc Setup.lhs build<br>
&nbsp;&nbsp;&nbsp; runghc Setup.lhs haddock<br>&nbsp;&nbsp;&nbsp; runghc Setup.lhs install<br><br>== Examples == <br><br>Training an ANN to the xor function:<br><br>&gt; import HFANN<br><br>&gt; main = do<br>&gt;&nbsp;&nbsp; withStandardFann [2,3,1] $ \fann -&gt; do<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; setActivationFunctionHidden fann fannSigmoidSymetric<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; setActivationFunctionOutput fann fannSigmoidSymetric<br><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; trainOnFile fann &quot;xor.data&quot; -- train data<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- max epochs<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- epochs between reports<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.001&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- desired error<br><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; saveFann fann &quot;xor.ann&quot;<br><br>C:\Temp\Haskell\hfann\examples\xor&gt;Train.exe<br>
Max epochs&nbsp;&nbsp;&nbsp; 20000. Desired error: 0.0010000000.<br>Epochs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. Current error: 0.2503675520. Bit fail 4.<br>Epochs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100. Current error: 0.0181358512. Bit fail 0.<br>Epochs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 169. Current error: 0.0009599295. Bit fail 0.<br>
<br><br>Using the trained ANN on the 4 possible input values to the xor function (-1 = False, 1 = True).<br><br>&gt; import HFANN<br><br>&gt; main = do<br>&gt;&nbsp;&nbsp; withSavedFann &quot;xor.ann&quot; $ \fann -&gt; do<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; mapM_ (\x -&gt; runFann fann x &gt;&gt;= print) [[-1,-1],[-1,1],[1,-1],[1,1]]<br>
<br>C:\Temp\Haskell\hfann\examples\xor&gt;Use.exe<br>[-0.950566361876292]<br>[0.9178714756661263]<br>[0.9457588340834527]<br>[-0.9482816646878051]<br><br>The &quot;xor.data&quot; training data content:<br>4 2 1<br>-1 -1<br>
-1<br>-1 1<br>1<br>1 -1<br>1<br>1 1<br>-1<br><br>The files for this example can be found in the &quot;examples/xor&quot; directory<br><br>==<br><br>Bug reports, suggestions and comments are welcome. You can send them directly to my e-mail address.<br>
<br>Olivier.<br>