Go to file
Gustav Louw 6c115010e5 lossless saving of floats 2018-04-03 15:27:44 -07:00
img image 2018-03-29 12:32:59 -07:00
.gitignore double to float 2018-03-31 04:29:03 -07:00
LICENSE Create LICENSE 2018-03-26 14:12:42 -07:00
Makefile makefile 2018-03-30 15:53:38 -07:00
README.md Update README.md 2018-04-02 15:31:27 +02:00
Tinn.c lossless saving of floats 2018-04-03 15:27:44 -07:00
Tinn.h cleanup 2018-04-03 15:12:36 -07:00
test.c cleanup 2018-04-03 15:12:36 -07:00

README.md

Tinn (Tiny Neural Network) is a 200 line dependency free neural network library written in C99. Tinn can be compiled with any C++ compiler as well.

#include "Tinn.h"
#include <stdio.h>

#define len(a) ((int) (sizeof(a) / sizeof(*a)))

int main()
{
    float in[] = { 0.05, 0.10 };
    float tg[] = { 0.01, 0.99 };
    /* Two hidden neurons */
    const Tinn tinn = xtbuild(len(in), 2, len(tg));
    for(int i = 0; i < 1000; i++)
    {
        float error = xttrain(tinn, in, tg, 0.5);
        printf("%.12f\n", error);
    }
    xtfree(tinn);
    return 0;
}

For a quick demo, get some training data:

wget http://archive.ics.uci.edu/ml/machine-learning-databases/semeion/semeion.data

And if you're on Linux / MacOS just build and run:

make; ./tinn

If you're on Windows it's:

mingw32-make & tinn.exe