Discussion:
problem: same output with different input data
Ondrej Vesely
2009-03-02 19:58:10 UTC
Permalink
Hi,

could anybody help me to solve quite confusing problem with simple usage of
FANN with C? There is no usable solution in e-mail archive or forum :(.

The point is that trained FANN produces the same output with different
input data. (Simmilar to this experience:
http://leenissen.dk/fann/forum/viewtopic.php?t=354&sid=741b1074786eaefcde263f802359800b
)

To be more specific:

--- head of input learning file --
1107 3 1
9 1 0
1
8 1 0
1
9 1 17
1
5 1 17
-1

I process the file with a variation of tutorial example which makes the
network in file.
This testing code produces table with numbers. Each numbers are the same.

--- main part of testing code
fann_type input[3];
int p,i;

struct fann *ann = fann_create_from_file("icq.net");

input[0] = (fann_type) 9; /* the same parameter */

for(p=0;p<24;p++) { /* makes a table with output data */
for(i=0;i<7;i++) {
input[0]=i;
input[1]=p;
calc_out = fann_run(ann, input);
printf("%.2f\t",calc_out);
}
putchar('\n');
}

The really confusing fact is, that every execution of testing code produces
different data (a table filled with one repeating number).
I have tried different header files (fann.h, doublefann.h) and two different
version of FANN library (2.1.0 and 2.0.0).

Thanks for any help :).

Ondrej
Adrian Spilca
2009-03-03 20:15:17 UTC
Permalink
Post by Ondrej Vesely
Hi,
could anybody help me to solve quite confusing problem with simple
usage of FANN with C? There is no usable solution in e-mail archive or
forum :(.
The point is that trained FANN produces the same output with
http://leenissen.dk/fann/forum/viewtopic.php?t=354&sid=741b1074786eaefcde263f802359800b
<http://leenissen.dk/fann/forum/viewtopic.php?t=354&sid=741b1074786eaefcde263f802359800b>)
--- head of input learning file --
1107 3 1
9 1 0
1
8 1 0
1
9 1 17
1
5 1 17
-1
I process the file with a variation of tutorial example which makes
the network in file.
This testing code produces table with numbers. Each numbers are the same.
--- main part of testing code
fann_type input[3];
int p,i;
struct fann *ann = fann_create_from_file("icq.net <http://icq.net>");
input[0] = (fann_type) 9; /* the same parameter */
for(p=0;p<24;p++) { /* makes a table with output data */
for(i=0;i<7;i++) {
input[0]=i;
input[1]=p;
calc_out = fann_run(ann, input);
printf("%.2f\t",calc_out);
}
putchar('\n');
}
The really confusing fact is, that every execution of testing code
produces different data (a table filled with one repeating number).
I have tried different header files (fann.h, doublefann.h) and two
different version of FANN library (2.1.0 and 2.0.0).
Thanks for any help :).
Ondrej
Hi Ondrej,

The simplest reason I could think of (if it is indeed similar with the
post in the forum), is that you don't link against the appropriate
library. If I remember well (I've done this a few years ago, so take the
advice with a pinch of salt), it's not enough to include the appropriate
header (like doublefann.h if you want double precision) but also you
need to build the right library. Something like this should appear in
your Makefile (again, for double)

gcc -Wall -O -ggdb -lm -DDEBUG -I../src/ -I../src/include/
../src/doublefann.c $< -o $@

(this old example I found was for building the debug version)

I know you were trying to switch header files, but it might be that the
library is built (default?) to work with fixed point numbers, in which
case neither float nor double would do.

Hope this helps,
Adrian

Continue reading on narkive:
Loading...