Genann - Neural Network Library
I've made a simple neural network library in ANSI C called Genann. I released it as open-source on github recently. You can find it here.
A primary design goal of Genann was to be both complete and minimal. I'm happy with how close I've come to that goal. Genann implements the feed-forward algorithm, backpropagation, and not much else. It's not opinionated about how you store your data or about how you do training. It is contained in just a single C source file and header file.
Genann is also very easy to use. For example, creating a network with 2 inputs, 3 hidden neurons, and 2 outputs is as easy as:
/* inputs, hidden layers, neurons per hidden layer, outputs. */ genann *ann = genann_init(2, 1, 3, 2);
That also creates the needed bias node connections automatically.
Training with backpropagation is simply:
/* genann, input array, output array, learning rate. */ genann_train(ann, inputs, expected_outputs, 0.1);
Doing a feed-forward pass is only:
double const *prediction = genann_run(ann, inputs);
Genann implements backpropagation, of course, but it also has another trick that most ANN libraries ignore. Backpropagation is good for supervised learning, but not reinforcement learning. Genann supports reinforcement learning by keeps all of its weights in one contiguous block of memory. This means that it is very easy to optimize the weights directly using numerical optimization techniques, such as the genetic algorithm.
If you have need for a minimal, no-frills ANN library in ANSI C, I encourage you to take a look at Genann. You can find documentation and several examples here.
Like this post? Consider following me on Twitter or following me on Github. Don't forget to subscribe to my feed.