I want the network to stop training when the bit fail is 0.
When that normally happens, the desired error is pretty low. But If I set the desired error too low, the network 开发者_StackOverflowwill keep training.. even over training even if the bit fail is 0....How to I find a good balance between desired error and bit fail?
TL;DR: How do I calculate the lowest possible desired error such that the network stops training when the bit fail reaches 0?
You can create a method of type fann_callback_type, let's call it trainCallback and then set this method as a callback to your NN (using the fann_set_callback method)
This method - trainingCallback - will be called while training, instead of printing out details of the training. In this callback you have access to all the information you need (MSE, bitfail etc. - check out the signature at the links above) and if you return a value smaller than 0, than the training will stop.
Hope it helps
int trainCallback(struct fann *ann, struct fann_train_data *train,
unsigned intmax_epochs, unsigned int epochs_between_reports,
float desired_error, unsigned int epochs) {
if(/*your condition*/)
return -1;
return 0;
}
/* in your code */
{
...
fann_set_callback(ptrToFANN, &trainCallback);
...
}
精彩评论