diff --git a/Tinn.c b/Tinn.c index 8c9c069..b300c91 100644 --- a/Tinn.c +++ b/Tinn.c @@ -125,14 +125,14 @@ static void twrand(Tinn t) #endif } -double ttrain(Tinn t, double* in, double* tg, double rate) +double xttrain(Tinn t, double* in, double* tg, double rate) { forewards(t, in); backwards(t, in, tg, rate); return error(t, tg); } -Tinn tbuild(int nips, int nops, int nhid) +Tinn xtbuild(int nips, int nops, int nhid) { Tinn t; t.o = (double*) calloc(nops, sizeof(*t.o)); @@ -145,7 +145,7 @@ Tinn tbuild(int nips, int nops, int nhid) return t; } -void tfree(Tinn t) +void xtfree(Tinn t) { free(t.w); free(t.h); diff --git a/Tinn.h b/Tinn.h index bb812fe..76e92cb 100644 --- a/Tinn.h +++ b/Tinn.h @@ -3,24 +3,19 @@ typedef struct { - double* o; /* Output layer */ - double* h; /* Hidden layer */ - double* w; /* Training weights */ - int nops; /* Number of Output Neurons */ - int nhid; /* Number of Hidden Neurons */ - int nips; /* Number of Input Neurons */ + double* o; + double* h; + double* w; + int nops; + int nhid; + int nips; } Tinn; -/* Trains a Tinn object given input (in) data, target (tg) data, - * and a learning rate (recommended 0.0 - 1.0) */ -double ttrain(Tinn, double* in, double* tg, double rate); +double xttrain(Tinn, double* in, double* tg, double rate); -/* Returns a Tinn object given number of inputs (nips), - * number of outputs (nops), and number of hidden layers (nhid) */ -Tinn tbuild(int nips, int nops, int nhid); +Tinn xtbuild(int nips, int nops, int nhid); -/* Frees a tinn object from heap memory */ -void tfree(Tinn); +void xtfree(Tinn); #endif diff --git a/test.c b/test.c index ffca78b..0c8fa10 100644 --- a/test.c +++ b/test.c @@ -26,11 +26,11 @@ int main() int nops = 1; double* in = inload(nips); double* tg = tgload(nops); - Tinn tinn = tbuild(nips, nops, nhid); + Tinn tinn = xtbuild(nips, nops, nhid); int i; for(i = 0; i <= 10000; i++) - printf("%.18f\n", ttrain(tinn, in, tg, 0.5)); - tfree(tinn); + printf("%.18f\n", xttrain(tinn, in, tg, 0.5)); + xtfree(tinn); free(in); free(tg); return 0;