/usr/share/doc/libfann-doc/examples/scaling_test.c is in libfann-doc 2.1.0~beta~dfsg-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <stdio.h>
#include "fann.h"
int main( int argc, char** argv )
{
fann_type *calc_out;
unsigned int i;
int ret = 0;
struct fann *ann;
struct fann_train_data *data;
printf("Creating network.\n");
ann = fann_create_from_file("scaling.net");
if(!ann)
{
printf("Error creating ann --- ABORTING.\n");
return 0;
}
fann_print_connections(ann);
fann_print_parameters(ann);
printf("Testing network.\n");
data = fann_read_train_from_file("/usr/share/doc/libfann-doc/examples/scaling.data");
for(i = 0; i < fann_length_train_data(data); i++)
{
fann_reset_MSE(ann);
/* Just pass any param to perform scaling */
if( argc > 1 )
{
fann_scale_input( ann, data->input[i] );
calc_out = fann_run( ann, data->input[i] );
fann_descale_output( ann, calc_out );
}
else
{
calc_out = fann_test(ann, data->input[i], data->output[i]);
}
printf("Result %f original %f error %f\n",
calc_out[0], data->output[i][0],
(float) fann_abs(calc_out[0] - data->output[i][0]));
}
printf("Cleaning up.\n");
fann_destroy_train(data);
fann_destroy(ann);
return ret;
}
|