2018-03-30 23:04:37 +03:00
|
|
|
#pragma once
|
2018-03-29 06:41:08 +03:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2018-04-11 05:12:35 +03:00
|
|
|
// All the weights.
|
|
|
|
float* w;
|
|
|
|
// Hidden to output layer weights.
|
|
|
|
float* x;
|
|
|
|
// Biases.
|
|
|
|
float* b;
|
|
|
|
// Hidden layer.
|
|
|
|
float* h;
|
|
|
|
// Output layer.
|
|
|
|
float* o;
|
|
|
|
|
|
|
|
// Number of biases - always two - Tinn only supports a single hidden layer.
|
|
|
|
int nb;
|
|
|
|
// Number of weights.
|
|
|
|
int nw;
|
|
|
|
|
|
|
|
// Number of inputs.
|
|
|
|
int nips;
|
|
|
|
// Number of hidden neurons.
|
|
|
|
int nhid;
|
|
|
|
// Number of outputs.
|
|
|
|
int nops;
|
2018-03-29 06:41:08 +03:00
|
|
|
}
|
|
|
|
Tinn;
|
|
|
|
|
2018-04-11 05:12:35 +03:00
|
|
|
float* xtpredict(Tinn, const float* in);
|
|
|
|
|
2018-04-04 01:12:36 +03:00
|
|
|
float xttrain(Tinn, const float* in, const float* tg, float rate);
|
2018-03-29 06:41:08 +03:00
|
|
|
|
2018-03-30 23:04:37 +03:00
|
|
|
Tinn xtbuild(int nips, int nhid, int nops);
|
2018-03-29 06:41:08 +03:00
|
|
|
|
2018-04-03 23:08:27 +03:00
|
|
|
void xtsave(Tinn, const char* path);
|
2018-03-31 01:42:20 +03:00
|
|
|
|
|
|
|
Tinn xtload(const char* path);
|
|
|
|
|
2018-04-03 23:08:27 +03:00
|
|
|
void xtfree(Tinn);
|
2018-04-11 19:34:56 +03:00
|
|
|
|
|
|
|
void xtprint(const float* arr, const int size);
|