From c285b7bea0301fea4694484cdbeeca6a2565d72c Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 3 Apr 2016 16:29:07 +0200 Subject: f*ck jsperf's crappy sigmoid implementation --- code/weightvis.js | 3 ++- index.html | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/code/weightvis.js b/code/weightvis.js index e3cec42..f61ec39 100644 --- a/code/weightvis.js +++ b/code/weightvis.js @@ -504,7 +504,7 @@ var NetVisualizer = (function() { NetVisualizer.prototype.activate = function(inputs) { // assumes the sigmoid function is used as activation - function activation(x) { return 0.5 + x / Math.sqrt(1 + 4 * x * x); } + function activation(x) { return 1 / (1 + Math.exp(-x)); } var weights = this.data[this.layout.data.batches-1][this.layout.data.epochs-1]; var lastLayerOut = inputs; var hasBias = false; @@ -525,6 +525,7 @@ var NetVisualizer = (function() { thisLayerOut[tar] = activation(thisLayerOut[tar]); } lastLayerOut = thisLayerOut; + //console.log("layer out", layer, lastLayerOut); } return lastLayerOut; }; diff --git a/index.html b/index.html index 7836a44..2e17c5c 100644 --- a/index.html +++ b/index.html @@ -138,14 +138,15 @@