Skip to content

Commit

Permalink
error calculation correction, fixes issue harthur#10
Browse files Browse the repository at this point in the history
  • Loading branch information
countable authored and harthur committed Dec 22, 2011
1 parent eb469ca commit 0ff481b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/neuralnetwork.js
Expand Up @@ -70,7 +70,7 @@ NeuralNetwork.prototype = {
var err = this.trainItem(data[j].input, data[j].output);
sum += Math.pow(err, 2);
}
error = Math.sqrt(sum) / data.length; // mean squared error
error = Math.sqrt(sum / data.length); // mean squared error

if(callback && (i % resolution == 0))
callback({error: error, iterations: i});
Expand Down Expand Up @@ -178,7 +178,7 @@ Layer.prototype = {
var sum = this.reduce(function(sum, node) {
return sum + Math.pow(node.error, 2);
}, 0);
return Math.sqrt(sum) / this.getSize(); // mean squared error
return Math.sqrt(sum / this.getSize()) // mean squared error
},

getSize : function() {
Expand Down

0 comments on commit 0ff481b

Please sign in to comment.