summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--code/weightvis.js3
-rw-r--r--index.html15
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 @@
<script type="text/javascript">
new VisIntegrater(function(c) {
weightsWrapper.afterLoad(function() {
- // TODO visualization
- // TODO shhht… find rows with diff<5 first
weightsWrapper.openIn(c);
- var row = Math.floor(Math.random()*bostonset.length());
- console.log(row);
- var inputs = bostonset.inputs(row);
- console.log(bostonset.asOutput(weightsWrapper.activate(inputs)[0]));
- console.log(bostonset.expectedOutput(row));
+ var testRows = [400, 175, 454, 481, 476, 364, 377, 75, 103, 84, 458, 483];
+ for(c=0; c<10; c++){
+ //var row = testRows[Math.floor(Math.random()*testRows.length)];
+ var row = Math.floor(Math.random()*bostonset.length());
+ var inputs = bostonset.inputs(row);
+ console.log("calculated", bostonset.asOutput(weightsWrapper.activate(inputs)[0]));
+ console.log("real", bostonset.expectedOutput(row));
+ }
});
}, function(c) {
weightsWrapper.remove(c);