summaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-04-03 16:29:07 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-04-03 16:29:07 +0200
commitc285b7bea0301fea4694484cdbeeca6a2565d72c (patch)
treeb203ed4018975404eb7bdff8c5378bd095e2b6aa /code
parent96744a133f3d421cdfcd9d18dd5f74981475fd5f (diff)
downloadvortrag-knn-c285b7bea0301fea4694484cdbeeca6a2565d72c.tar.gz
vortrag-knn-c285b7bea0301fea4694484cdbeeca6a2565d72c.zip
f*ck jsperf's crappy sigmoid implementation
Diffstat (limited to 'code')
-rw-r--r--code/weightvis.js3
1 files changed, 2 insertions, 1 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;
};