From 96744a133f3d421cdfcd9d18dd5f74981475fd5f Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 2 Apr 2016 21:33:19 +0200 Subject: integrate boston housing dataset and test values --- code/bostonset.js | 100 +++++++++++++++++++++++++++++++++++++++++++++++ code/weightvis.js | 30 +++++++++++++- code/weightviswrapper.js | 5 +++ 3 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 code/bostonset.js (limited to 'code') diff --git a/code/bostonset.js b/code/bostonset.js new file mode 100644 index 0000000..50b9d38 --- /dev/null +++ b/code/bostonset.js @@ -0,0 +1,100 @@ +var Bostonset = (function() { + var attrs = + ["crim", "zn", "indus", "chas", "nox", "rm", "age", "dis", "rad", "tax", "ptratio", "black", "lstat", "medv"]; + + function Bostonset() { + this.data = []; + // fixed constants exported from training data + this.dataScaler = new MinMaxScaler(); + this.dataScaler.setScales([[0.00632, 0.0, 0.46, 0.0, 0.385, 3.561, 2.9, 1.1296, 1.0, 187.0, 12.6, 0.32, 1.73], [88.9762, 100.0, 27.74, 1.0, 0.871, 8.78, 100.0, 12.1265, 24.0, 711.0, 22.0, 396.9, 37.97]]); + this.targetScaler = new MinMaxScaler(); + this.targetScaler.setScales([5.0, 50.0]); + } + + Bostonset.prototype.load = function(url) { + var self = this; + d3.csv(url).get(function(e, data) { + if (e) console.log(e); + data.forEach(function (el) { + var arr = []; + for (c=0; c 0 possible? var Network = (function() { function Network(layout) { this.layout = layout; @@ -499,9 +499,35 @@ var NetVisualizer = (function() { me.attr("data-highlight", "true"); } }); - this.reposition(); }; + 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); } + var weights = this.data[this.layout.data.batches-1][this.layout.data.epochs-1]; + var lastLayerOut = inputs; + var hasBias = false; + if (this.layout.net[0].isBias) { + for (bias=0; bias