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 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 code/bostonset.js (limited to 'code/bostonset.js') 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