Fast Artificial Neural Network Library (FANN)
Reference Manual for latest CVS release
An ANN is normally run in two different modes, a training mode and an execution mode. Although it is possible to do this in the same program, using different programs is recommended.
There are several reasons to why it is usually a good idea to write the training and execution in two different programs, but the most obvious is the fact that a typical ANN system is only trained once, while it is executed many times.
The following is a simple program which trains an ANN with a data set and then saves the ANN to a file.
Simple training example
The file xor.data, used to train the xor function
4 2 1
The first line consists of three numbers: The first is the number of training pairs in the file, the second is the number of inputs and the third is the number of outputs. The rest of the file is the actual training data, consisting of one line with inputs, one with outputs etc.
The following example shows a simple program which executes a single input on the ANN. The program introduces two new functions (fann_create_from_file and fann_run) which were not used in the training procedure, as well as the fann_type type.
Simple execution example
If after reading the documentation you are still having problems, or have a question that is not covered in the documentation, please consult the fann-general mailing list. Archives and subscription information are available at http://lists.sourceforge.net- /mailman- /listinfo- /fann-general.
Creates a standard fully connected backpropagation neural network.
FANN_EXTERNAL struct fann *FANN_API fann_create_standard( unsigned int num_layers, ... )
Does the same as fann_train_on_data, but reads the training data directly from a file.
FANN_EXTERNAL void FANN_API fann_train_on_file( struct fann * ann, const char * filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error )
Save the entire network to a configuration file.
FANN_EXTERNAL int FANN_API fann_save( struct fann * ann, const char * configuration_file )
Destroys the entire network and properly freeing all the associated memmory.
FANN_EXTERNAL void FANN_API fann_destroy( struct fann * ann )
Constructs a backpropagation neural network from a configuration file, which have been saved by fann_save.
FANN_EXTERNAL struct fann *FANN_API fann_create_from_file( const char * configuration_file )
Will run input through the neural network, returning an array of outputs, the number of which being equal to the number of neurons in the output layer.
FANN_EXTERNAL fann_type * FANN_API fann_run( struct fann * ann, fann_type * input )