Search code examples
c++fann

fann_set_bit_fail_limit() fails to actually set the bit fail limit, forcing me to manually edit the ANN file


struct fann *ann;
ann = fann_create_standard(3, 600, 1200, 30);
fann_set_activation_function_hidden(ann, FANN_SIGMOID);
fann_set_activation_function_output(ann, FANN_SIGMOID);
fann_set_bit_fail_limit(ann, 0.002);
fann_save(ann, "ann.net");

Whenever I load this neural network from the file and read fann_get_bit_fail_limit(), the returned value is the default 0.35 instead of the 0.002 I tried to set. I have to edit the ANN file manually for it to take effect.

I am using doublefann.h. Am I doing something wrong?


Solution

  • "Am I doing something wrong?"

    As per Documentation - FANN Training > Parameters > fann_get_bit_fail_limit (emphasis added) :

    The bit fail limit is used during training where the fann_stopfunc_enum is set to FANN_STOPFUNC_BIT.

    Example :

    fann_set_train_stop_function(ann, FANN_STOPFUNC_BIT);
    fann_set_bit_fail_limit(ann, 0.002);
    fann_save(ann, "ann.net");
    

    Just in case:

    I am using doublefann.h.

    Link -ldoublefann instead of -lfann.