Did you know ... Search Documentation:
Pack plfann -- plfann.txt
plfann ------

The enclosed files, fann_swi.h, plfann.h, plfann.c and plfann.pl form the SWI- Prolog bindings to the Fast Artificial Neural Network library. fann is an open source ANN-library and is released under the LGPL.

The version of the library for which these bindings are intended to be used with is version 2.1.0. Functions foreseen to be available in release 2.2.0 are equally included, but have been commented out.

On the fann home page, links are provided to the Source Code, the Reference Manual and additionally, more general, materials related to ANN's.

fann home page: http://leenissen.dk/fann/

All available functions are implemented, with the exception of:

  1. fann_create_train_from_callback
  2. fann_set_callback

In total 150 public predicates are defined.

The predicate names, used in this library, are the same as the ones in the reference manual. C-Function-return-arguments are added as an additional (and last) argument to the predicates concerned. In a small number of functions, having length values, like f.e. the length of an input array, these arguments have been removed, as these can be obtained in the prolog interface at relative- ly low cost.

fann can use floats, doubles or fixed point (not for training) representation internally, uncomment the appropriate variable definition in plfann.h.

Three additional functions/predicates have been added:

  1. fann_type(-Type)
    Unifies Type with 'FANN_FLOAT', 'FANN_DOUBLE' or 'FANN_FIXED', depending
    on the compilation of the library.
  2. fann_error(+ErrorData)
    Is true if an error occurred. ErrorData refers to the ErrorData set by
    fann_set_error_log/2, or if no ErrorData is specifically set, to 'NULL'.
    The latter is equivalent to calling fann_print_error/0.
  3. fann_print_mode(+-Mode)
    Sets  the printing  of the  library to  either  standard  output  device
    (Mode = 'FANN_NATIVE') or  the  SWI-Prolog  console (Mode = 'FANN_SWI').
    In the latter case, the SWI_Prolog message system is used to this end.
    
    The loading of the plfann-library  (i.e. on startup of SWI-Prolog) auto-
    matically sets the printing mode to 'FANN_SWI'.
    
    When called with a free  variable, Mode unifies  with the current  print
    mode, either 'FANN_SWI' or 'FANN_NATIVE'.

The idea of the above is to ALSO be able to build just one library (as opposed to fann and plfann) with the SWI-Prolog bindings included and still be able to use the same library both directly from C/C++ and SWI-Prolog.

In order for this to work, the header-file fann_swi.h will need to be included in fann.h, by adding the line '#include "fann_swi.h"' (without the single quotes) after the other #include statements (around line 140).

The macro BUILD_FANN_WITH_SWI will need to be defined, when building the fann library.

The header-file fann_swi.h will need to be copied/moved to the "../src/include/" directory of the source distribution, this is also where "fann.h" is located.

The result is that iff the library is loaded through SWI-Prolog, the printing of all output of the library will be directed to the SWI-Prolog console. If loaded by another application or library, the standard output is used by default. It is possible to override this behaviour, both from c and from prolog, see fann_swi.h for details.

fann can use floats, doubles or fixed point (not for training) representation internally, uncomment the appropriate macro definition in plfann.h.

There are some issues with saving networks to file. See post "Patch to ensure locale independancy", http://leenissen.dk/fann/forum/viewtopic.php?f=2&t=595 . A patch is posted.

dated: 18.12.2009

degski [ta] gmail [tod] com