pofi pajti
2008-09-28 17:00:06 UTC
Hi!
I have trained a neural network as described in the tutorial. Now I would like to get the results from data in a testing file. What I am doing is the following:
--------------------------------------------------------
char * test_file = "path/to/testfile";
char * network_file = "path/to/network";
fann_type *calc_out;
fann_train_data * test_data = fann_read_train_from_file(test_file);
struct fann *ann = fann_create_from_file(network_file);
for (int i = 0; i < test_data->num_data; i++)
{
fann_type * input = test_data->input[i];
calc_out = fann_run(ann, input);
printf("test (%f,%f) -> %f\n", input[0], input[1], calc_out[0]);
}
fann_destroy(ann);
--------------------------------------------------------
However on the screen I am getting totally different numbers printed out for the inputs with respect to those in the test file.
I have two questions:
- what is wrong in the code above?
- is there a better way of testing an entire file?
thanks
Andras
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
I have trained a neural network as described in the tutorial. Now I would like to get the results from data in a testing file. What I am doing is the following:
--------------------------------------------------------
char * test_file = "path/to/testfile";
char * network_file = "path/to/network";
fann_type *calc_out;
fann_train_data * test_data = fann_read_train_from_file(test_file);
struct fann *ann = fann_create_from_file(network_file);
for (int i = 0; i < test_data->num_data; i++)
{
fann_type * input = test_data->input[i];
calc_out = fann_run(ann, input);
printf("test (%f,%f) -> %f\n", input[0], input[1], calc_out[0]);
}
fann_destroy(ann);
--------------------------------------------------------
However on the screen I am getting totally different numbers printed out for the inputs with respect to those in the test file.
I have two questions:
- what is wrong in the code above?
- is there a better way of testing an entire file?
thanks
Andras
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/