FANN Bindings

From SUMOwiki
Jump to: navigation, search

Contents

FANN: Fast Artificial Neural Network Library

From the FANN website:

Fast Artificial Neural Network Library is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks. Cross-platform execution in both fixed and floating point are supported. It includes a framework for easy handling of training data sets. It is easy to use, versatile, well documented, and fast. PHP, C++, .NET, Ada, Python, Delphi, Octave, Ruby, Prolog Pure Data and Mathematica bindings are available. A reference manual accompanies the library with examples and recommendations on how to use the library. A graphical user interface is also available for the library.

FANN Matlab bindings

The Matlab Neural Network toolbox is a great piece of software but unfortunately much too slow. Therefore I decided to add the FANN library as an optional backend. Unfortunately there were no Matlab bindings available so I quickly hacked some together. I'd never written Mex files before and my C skills are very rusty to say the least so I thought it would be a good exercise. I'm putting them online in the hope somebody will pick them up and improve/extend them (since they are pretty basic).

Note that I am only interested in regression (function approximation) so my bindings only reflect that tiny subset of the total FANN features.

Download

Use these bindings at your own risk! They work for me but don't expect me to guarantee anything!

License: GPL v2 or later

Download: https://github.com/dgorissen/mfann

Installation

Version of the FANN library required: 2.1beta

Enclosed is a GNU makefile that builds the mex files (you may have to edit the makefile a little to accommodate for your environment). If anybody is willing to contribute windows binaries or Makefiles please do!

Make sure the mex files are in your Matlab path and Matlab knows where to find the FANN library (e.g., see LD_LIBRARY_PATH on unix systems).

Usage

  • Create a network
ann = createFann([2 5 3 1],connectivity)
  • Train a network
ann = trainFann(ann,samples,values,[desired error],[max epochs])
  • Use a network
values = testFann(ann,samples)

Where samples are the input data points and values the output values, both in column format (1 column per dimension).

Note: do not use a connectivity different from 1 for else you will get wrong results (I hope this can be fixed with the new fann library)

Contribute

These bindings are very basic but they work for me. Please improve, extend, provide binaries, and of course contribute back.

Personal tools