From 06f2e600b1b87c7d738c7f0645ea3f2a25fbbe29 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 2 Apr 2016 10:57:40 +0200 Subject: simplify weightVis usage --- code/weightvis.js | 3 +- index.css | 21 -------- index.html | 149 +++++++++++++++++------------------------------------- 3 files changed, 49 insertions(+), 124 deletions(-) diff --git a/code/weightvis.js b/code/weightvis.js index f777755..5265cee 100644 --- a/code/weightvis.js +++ b/code/weightvis.js @@ -288,12 +288,13 @@ var NetVisualizer = (function() { }; NetVisualizer.prototype.stopAnimation = function() { - this.animator.stop(); + if (this.animator) this.animator.stop(); }; NetVisualizer.prototype.animate = function(animationTime, resolution, step) { // animationTime in seconds per frame // resolution in epochs per frame + if (!step) step = 0; var self = this; var batch = Math.floor(step / this.layout.data.epochs), epoch = step % this.layout.data.epochs; diff --git a/index.css b/index.css index 8ba1365..62639f4 100644 --- a/index.css +++ b/index.css @@ -20,27 +20,6 @@ time, mark, audio, video { vertical-align: baseline; } -.svgContainer { - margin-top: 1.5em; - margin-bottom: 1em; - height: 100%; -} - -.contentLoader { - position: absolute; - left: 50%; - top: 50%; -} - h1, h2, h3, h4, h5, h6 { text-align: center; } - -.center { - margin-left: auto; - margin-right: auto; -} -.vcenter { - margin-top: auto; - margin-bottom: auto; -} diff --git a/index.html b/index.html index 7cb910a..c750c2b 100644 --- a/index.html +++ b/index.html @@ -11,24 +11,32 @@ + + + +
@@ -44,109 +52,46 @@

Die Gewichte im Verlauf

-
-
-
-
- -

- -

+
- +
- netVisualizer.load("data/weights.json", function(){ - d3.select("#svgLoader").remove(); - d3.select("#visContainer").node().appendChild(svg.node()); - var attributeNames = - ["CRIM", "ZN", "INDUS", "CHAS", "NOX", "RM", "AGE", "DIS", "RAD", "TAX", "PTRATIO", "B", "LSTAT"]; - var inputNodes = d3.selectAll(".layer-1")[0]; - console.log(inputNodes); - for (node=0; node= slider.max * 0.95) { - slider.MaterialSlider.change(0); // wrap at right end - } - }); - svg - .style("width", container.style("width")) - .style("height", container.style("height")); - netVisualizer.reposition(); - placeAttributes(); - var slider = d3.select("#visSlider").attr("max", netVisualizer.getSteps() - 1); - slider.node().addEventListener("input", function() { - netVisualizer.showStep(this.value); - }); - d3.select("#visPlayButton").node().addEventListener("click", function() { - var btn = d3.select(this); - if (btn.attr("data-pressed") != "true") { - var step = d3.select("#visSlider").node().value; - netVisualizer.animate(15, 10, step); - btn.attr("data-pressed", "true"); - d3.select("#visPlay").style("display", "none"); - d3.select("#visPause").style("display", ""); - } else { - netVisualizer.stopAnimation(); - btn.attr("data-pressed", "false"); - d3.select("#visPlay").style("display", ""); - d3.select("#visPause").style("display", "none"); - } - }); +
+
+

Gewichte und Fehler

+
- loaded = true; - }); +
+
+
-- cgit v1.3.1