diff --git a/dist/synaptic.js b/dist/synaptic.js index c46420b..aeb5340 100644 --- a/dist/synaptic.js +++ b/dist/synaptic.js @@ -1969,6 +1969,7 @@ testSet = set.slice(numTrain); } + var lastError = 0; while ((!abort && iterations < this.iterations && error > this.error)) { if (crossValidate && error <= this.crossValidate.testError) { break; @@ -1984,7 +1985,7 @@ } if(typeof this.rate === 'function') { - currentRate = this.rate(iterations, error); + currentRate = this.rate(iterations, lastError); } if (crossValidate) { @@ -1998,6 +1999,7 @@ // check error error /= currentSetSize; + lastError = error; if (options) { if (this.schedule && this.schedule.every && iterations % diff --git a/src/trainer.js b/src/trainer.js index 6e58f95..40b57a3 100644 --- a/src/trainer.js +++ b/src/trainer.js @@ -74,6 +74,7 @@ Trainer.prototype = { testSet = set.slice(numTrain); } + var lastError = 0; while ((!abort && iterations < this.iterations && error > this.error)) { if (crossValidate && error <= this.crossValidate.testError) { break; @@ -89,7 +90,7 @@ Trainer.prototype = { } if(typeof this.rate === 'function') { - currentRate = this.rate(iterations, error); + currentRate = this.rate(iterations, lastError); } if (crossValidate) { @@ -103,6 +104,7 @@ Trainer.prototype = { // check error error /= currentSetSize; + lastError = error; if (options) { if (this.schedule && this.schedule.every && iterations %