diff --git a/lib/neuralnetwork.js b/lib/neuralnetwork.js index cbbb39c..98a9120 100644 --- a/lib/neuralnetwork.js +++ b/lib/neuralnetwork.js @@ -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}); @@ -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() {