2018-03-29 22:33:19 +03:00
|
|
|
![](img/logo.PNG)
|
2018-03-27 05:09:24 +03:00
|
|
|
|
2018-03-30 23:12:51 +03:00
|
|
|
Tinn (Tiny Neural Network) is a dependency free neural network library written in C99.
|
2018-03-27 05:09:24 +03:00
|
|
|
|
2018-03-30 00:32:11 +03:00
|
|
|
#include "Tinn.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define len(a) ((int) (sizeof(a) / sizeof(*a)))
|
|
|
|
|
2018-03-30 23:26:46 +03:00
|
|
|
int main()
|
2018-03-30 00:32:11 +03:00
|
|
|
{
|
|
|
|
double in[] = { 0.05, 0.10 };
|
|
|
|
double tg[] = { 0.01, 0.99 };
|
2018-03-30 23:49:13 +03:00
|
|
|
/* Two hidden neurons */
|
2018-03-30 00:32:11 +03:00
|
|
|
const Tinn tinn = xtbuild(len(in), 2, len(tg));
|
2018-03-30 23:19:40 +03:00
|
|
|
for(int i = 0; i < 1000; i++)
|
2018-03-30 00:32:11 +03:00
|
|
|
{
|
|
|
|
double error = xttrain(tinn, in, tg, 0.5);
|
|
|
|
printf("%.12f\n", error);
|
|
|
|
}
|
|
|
|
xtfree(tinn);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-30 23:12:51 +03:00
|
|
|
For a quick demo, get some training data:
|
2018-03-30 23:10:23 +03:00
|
|
|
|
|
|
|
wget http://archive.ics.uci.edu/ml/machine-learning-databases/semeion/semeion.data
|
|
|
|
|
2018-03-30 23:12:51 +03:00
|
|
|
And if you're on Linux / MacOS just build and run:
|
2018-03-27 05:09:24 +03:00
|
|
|
|
2018-03-29 08:08:19 +03:00
|
|
|
make; ./tinn
|
2018-03-30 23:12:51 +03:00
|
|
|
|
|
|
|
If you're on Windows it's:
|
|
|
|
|
|
|
|
mingw32-make & tinn.exe
|