From 0212eceb025941777a68febe1ac0327c6f5d4658 Mon Sep 17 00:00:00 2001 From: Nico Madysa Date: Tue, 24 Jul 2018 22:32:51 +0200 Subject: [PATCH 1/2] Fix deviations from official iRProp- algorithm. The iRProp- algorithm as given in its original paper does not have weight-backtracking: If the sign of the derivative changes in an iteration, the weights should not be updated at all. --- src/fann_train.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fann_train.c b/src/fann_train.c index 049e6de9..85d57b38 100644 --- a/src/fann_train.c +++ b/src/fann_train.c @@ -734,15 +734,15 @@ void fann_update_weights_irpropm(struct fann *ann, unsigned int first_weight, un same_sign = prev_slope * slope; - if(same_sign >= 0.0) + if(same_sign > 0.0) next_step = fann_min(prev_step * increase_factor, delta_max); - else + else if(same_sign < 0.0) { next_step = fann_max(prev_step * decrease_factor, delta_min); slope = 0; } - if(slope < 0) + if(slope < 0.0) { weights[i] -= next_step; if(weights[i] < -1500) From fac4d19fc792e262c1ad182c350e4281793600fd Mon Sep 17 00:00:00 2001 From: Nico Madysa Date: Sat, 4 Apr 2020 13:53:56 +0200 Subject: [PATCH 2/2] Revert "Fix deviations from official iRProp- algorithm." This reverts commit 0212eceb025941777a68febe1ac0327c6f5d4658. --- src/fann_train.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fann_train.c b/src/fann_train.c index 85d57b38..049e6de9 100644 --- a/src/fann_train.c +++ b/src/fann_train.c @@ -734,15 +734,15 @@ void fann_update_weights_irpropm(struct fann *ann, unsigned int first_weight, un same_sign = prev_slope * slope; - if(same_sign > 0.0) + if(same_sign >= 0.0) next_step = fann_min(prev_step * increase_factor, delta_max); - else if(same_sign < 0.0) + else { next_step = fann_max(prev_step * decrease_factor, delta_min); slope = 0; } - if(slope < 0.0) + if(slope < 0) { weights[i] -= next_step; if(weights[i] < -1500)