diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-04-01 18:39:49 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-04-01 18:39:49 +0200 |
| commit | c3338d84e6983fb4e6440bca0538fbf6795000c3 (patch) | |
| tree | bac9b7360017bb0286485813227df992f0ba6ce6 /code/weightvis.js | |
| parent | 4180d54aef2022f0f5e75e9e300e6b427d331d5a (diff) | |
| download | vortrag-knn-c3338d84e6983fb4e6440bca0538fbf6795000c3.tar.gz vortrag-knn-c3338d84e6983fb4e6440bca0538fbf6795000c3.zip | |
update data structure
Diffstat (limited to 'code/weightvis.js')
| -rw-r--r-- | code/weightvis.js | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/code/weightvis.js b/code/weightvis.js index 10a9ed2..f777755 100644 --- a/code/weightvis.js +++ b/code/weightvis.js @@ -259,24 +259,24 @@ var Animator = (function() { /* main */ -var Visualizer = (function() { +var NetVisualizer = (function() { var _weightScaler = 10; // size of thickest line - function Visualizer(svg) { + function NetVisualizer(svg) { this.loader = new Loader(); this.svg = svg; this.stepHooks = []; this.stopHooks = []; } - Visualizer.prototype.getSteps = function() { + NetVisualizer.prototype.getSteps = function() { return this.layout.data.batches * this.layout.data.epochs; }; - Visualizer.prototype.getDatashape = function() { + NetVisualizer.prototype.getDatashape = function() { return this.layout.data; }; - Visualizer.prototype.load = function(url, callback) { + NetVisualizer.prototype.load = function(url, callback) { var self = this; function wrapper(layout, data) { self.layout = layout; @@ -284,14 +284,14 @@ var Visualizer = (function() { self._setup(); callback(); } - this.loader.load("data/log.json", wrapper); + this.loader.load(url, wrapper); }; - Visualizer.prototype.stopAnimation = function() { + NetVisualizer.prototype.stopAnimation = function() { this.animator.stop(); }; - Visualizer.prototype.animate = function(animationTime, resolution, step) { + NetVisualizer.prototype.animate = function(animationTime, resolution, step) { // animationTime in seconds per frame // resolution in epochs per frame var self = this; @@ -305,21 +305,21 @@ var Visualizer = (function() { }); }; - Visualizer.prototype.hookStepper = function(hook) { + NetVisualizer.prototype.hookStepper = function(hook) { this.stepHooks.push(hook); }; - Visualizer.prototype.hookStop = function(hook) { + NetVisualizer.prototype.hookStop = function(hook) { this.stopHooks.push(hook); }; - Visualizer.prototype.showStep = function(step) { + NetVisualizer.prototype.showStep = function(step) { var epoch = step % this.layout.data.epochs, batch = Math.floor(step / this.layout.data.epochs); this.show(batch, epoch); }; - Visualizer.prototype.show = function(batch, epoch, transitionDuration) { + NetVisualizer.prototype.show = function(batch, epoch, transitionDuration) { var self = this; this.network.updateWeights(this.data[batch][epoch], this.layout.layers[batch][epoch]); if (transitionDuration) { @@ -339,8 +339,7 @@ var Visualizer = (function() { this.stepHooks.forEach(function(hook){ hook(batch * self.layout.data.epochs + epoch); }); }; - Visualizer.prototype.reposition = function() { - if (!this.svg) return; + NetVisualizer.prototype.reposition = function() { var width = parseInt(this.svg.style("width")) || 800, height = parseInt(this.svg.style("height")) || 600; var node = this.svg.selectAll(".node"); @@ -358,7 +357,7 @@ var Visualizer = (function() { .attr("y2", function(d) { return d.target.y; }); }; - Visualizer.prototype._setup = function() { + NetVisualizer.prototype._setup = function() { var self = this; // create empty elements and determine the visualisation's size var width = parseInt(this.svg.style("width")) || 800, @@ -443,5 +442,5 @@ var Visualizer = (function() { this.reposition(); }; - return Visualizer; + return NetVisualizer; })(); |
