tinn/README.md

37 lines
905 B
Markdown
Raw Normal View History

2018-03-29 22:33:19 +03:00
![](img/logo.PNG)
2018-03-27 05:09:24 +03:00
2018-03-31 02:52:20 +03:00
Tinn (Tiny Neural Network) is a 200 line dependency free neural network library written in C99.
2018-03-31 02:55:01 +03:00
Tinn can be compiled with any C++ compiler as well.
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
{
2018-04-02 16:31:27 +03:00
float in[] = { 0.05, 0.10 };
float 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
{
2018-04-02 16:31:27 +03:00
float error = xttrain(tinn, in, tg, 0.5);
2018-03-30 00:32:11 +03:00
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