diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-04-03 17:16:03 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-04-03 17:16:03 +0200 |
| commit | 6f70c1a4e47b0bc96ed0ebcca0eb384a5dfdc2f4 (patch) | |
| tree | a34b4cc2100346f727199a3e7133c0cbbca3a68a /code/weightvis.js | |
| parent | c285b7bea0301fea4694484cdbeeca6a2565d72c (diff) | |
| download | vortrag-knn-6f70c1a4e47b0bc96ed0ebcca0eb384a5dfdc2f4.tar.gz vortrag-knn-6f70c1a4e47b0bc96ed0ebcca0eb384a5dfdc2f4.zip | |
calculate and visualize network activation
Diffstat (limited to 'code/weightvis.js')
| -rw-r--r-- | code/weightvis.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/code/weightvis.js b/code/weightvis.js index f61ec39..2ef33e1 100644 --- a/code/weightvis.js +++ b/code/weightvis.js @@ -30,7 +30,9 @@ var linkHighlightColor = pDeepPurple[5], linkHighlightColorAlt = pPink[5], nodeColor = pDeepPurple[4], - nodeHighlightColor = accentColor + nodeColorAlt = pPink[4], + nodeHighlightColor = accentColor, + nodeHighlightColorAlt = pPinkA[3] ; /* network construction */ @@ -63,6 +65,7 @@ var Network = (function() { this.nodes.push({ id: layer.toString() + "_" + node.toString(), layer: layer, + node: node, fixed: true }); } @@ -507,12 +510,14 @@ var NetVisualizer = (function() { 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 activations = [inputs]; var hasBias = false; if (this.layout.net[0].isBias) { for (bias=0; bias<inputs.length; bias++) { lastLayerOut[bias] += weights[0][0][bias]; } hasBias = true; + activations.push(lastLayerOut); } for (layer=hasBias?1:0; layer<this.layout.net.layers-1; layer++) { // manual vector matrix multiplication @@ -525,9 +530,9 @@ var NetVisualizer = (function() { thisLayerOut[tar] = activation(thisLayerOut[tar]); } lastLayerOut = thisLayerOut; - //console.log("layer out", layer, lastLayerOut); + activations.push(lastLayerOut); } - return lastLayerOut; + return activations; }; return NetVisualizer; |
