summaryrefslogtreecommitdiff
path: root/code/bostonset.js
diff options
context:
space:
mode:
Diffstat (limited to 'code/bostonset.js')
-rw-r--r--code/bostonset.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/code/bostonset.js b/code/bostonset.js
index 50b9d38..f5f1264 100644
--- a/code/bostonset.js
+++ b/code/bostonset.js
@@ -9,6 +9,7 @@ var Bostonset = (function() {
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]);
+ this.readyHooks = [];
}
Bostonset.prototype.load = function(url) {
@@ -22,15 +23,33 @@ var Bostonset = (function() {
}
self.data.push(arr);
});
+ self.readyHooks.forEach(function(hook) { hook(); });
});
};
+ Bostonset.prototype.afterLoad = function(cb) {
+ if (!this.ready) {
+ this.readyHooks.push(cb);
+ } else {
+ cb();
+ }
+ };
+
+ Bostonset.prototype.attributes = function() {
+ console.log(attrs);
+ return attrs;
+ };
+
Bostonset.prototype.length = function() {
return this.data.length;
};
+ Bostonset.prototype.rawData = function(row) {
+ return this.data[row];
+ };
+
Bostonset.prototype.rawInputs = function(row) {
- return this.data[row].slice(0, -1); // leave out MEDV
+ return this.rawData(row).slice(0, -1); // leave out MEDV
};
Bostonset.prototype.inputs = function(row) {