diff options
author | Renato Utsch <renatoutsch@google.com> | 2016-08-04 15:30:03 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-08-04 16:32:59 -0700 |
commit | cfc5af551532bc095d68a1a16deaaee1cc04ca91 (patch) | |
tree | 27d5b11020332eb0ad897db5042eeed520fda225 | |
parent | ee9241825d80bf295963ac2fad4dfa0fc9a7b998 (diff) |
- Rename the Histograms tab to Distributions so that we can prepare for the new
histograms that are being implemented.
Change: 129387387
8 files changed, 22 insertions, 151 deletions
diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-obsolete-histogram-chart.html b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-chart.html index d5ddf142a8..d58520a8a7 100644 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-obsolete-histogram-chart.html +++ b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-chart.html @@ -2,7 +2,7 @@ <link rel="import" href="../tf-imports/plottable.html"> <link rel="import" href="../tf-imports/lodash.html"> -<dom-module id="tf-obsolete-histogram-chart"> +<dom-module id="tf-distribution-chart"> <template> <svg id="chartsvg"></svg> <style> @@ -24,11 +24,11 @@ </style> </template> - <script src="tf-obsolete-histogram-chart.js"></script> + <script src="tf-distribution-chart.js"></script> <script src="../vz-line-chart/vz-chart-helpers.js"></script> <script> Polymer({ - is: "tf-obsolete-histogram-chart", + is: "tf-distribution-chart", properties: { _chart: Object, colorScale: Object, @@ -60,7 +60,7 @@ return; } if (this._chart) this._chart.destroy(); - var chart = new TF.HistogramChart(tag, dataProvider, xType, colorScale); + var chart = new TF.DistributionChart(tag, dataProvider, xType, colorScale); var svg = d3.select(this.$.chartsvg); this.async(function() { chart.renderTo(svg); diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-obsolete-histogram-chart.ts b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-chart.ts index c593b9d4d4..981656a814 100644 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-obsolete-histogram-chart.ts +++ b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-chart.ts @@ -15,7 +15,7 @@ limitations under the License. /* tslint:disable:no-namespace variable-name */ module TF { - export class HistogramChart { + export class DistributionChart { protected dataFn: VZ.ChartHelpers.DataFn; protected tag: string; private run2datasets: {[run: string]: Plottable.Dataset}; diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-histogram-dashboard.html b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-dashboard.html index 6dab1bda03..962dcdef13 100644 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/tf-histogram-dashboard.html +++ b/tensorflow/tensorboard/components/tf-distribution-dashboard/tf-distribution-dashboard.html @@ -4,7 +4,7 @@ <link rel="import" href="../tf-color-scale/tf-color-scale.html"> <link rel="import" href="../tf-dashboard-common/tf-dashboard.html"> <link rel="import" href="../tf-categorizer/tf-categorizer.html"> -<link rel="import" href="tf-obsolete-histogram-chart.html"> +<link rel="import" href="tf-distribution-chart.html"> <link rel="import" href="../tf-collapsable-pane/tf-collapsable-pane.html"> <link rel="import" href="../iron-collapse/iron-collapse.html"> <link rel="import" href="../paper-icon-button/paper-icon-button.html"> @@ -12,7 +12,7 @@ <link rel="import" href="../tf-backend/tf-backend.html"> <!-- -tf-histogram-dashboard is a complete frontend that loads runs from a backend, +tf-distribution-dashboard is a complete frontend that loads runs from a backend, and creates chart panes that display data for those runs. It provides a categorizer, run selector, and x type selector, by which the user @@ -24,10 +24,10 @@ charts are larger. Organizationally, the #plumbing div contains components that have no concrete manifestation and just effect data bindings or data loading. The #sidebar contains shared controls like the tf-categorizer, tf-run-selector, and tf-x-type-selector. -The #center div contains tf-obsolete-histogram-charts embedded inside +The #center div contains tf-distribution-charts embedded inside tf-collapsable-panes. --> -<dom-module id="tf-histogram-dashboard"> +<dom-module id="tf-distribution-dashboard"> <template> <div id="plumbing"> <tf-color-scale @@ -64,7 +64,7 @@ tf-collapsable-panes. <div class="center"> <tf-no-data-warning - data-type="histogram" + data-type="distribution" show-warning="[[dataNotFound]]" ></tf-no-data-warning> <template is="dom-repeat" items="[[categories]]"> @@ -76,7 +76,7 @@ tf-collapsable-panes. <div class="card"> <span class="card-title">[[tag]]</span> <div class="card-content"> - <tf-obsolete-histogram-chart + <tf-distribution-chart tag="[[tag]]" id="chart" selected-runs="[[_array(run)]]" @@ -85,7 +85,7 @@ tf-collapsable-panes. color-scale="[[colorScale]]" on-keyup="toggleSelected" tabindex="2" - ></tf-obsolete-histogram-chart> + ></tf-distribution-chart> <paper-icon-button class="expand-button" icon="fullscreen" @@ -107,9 +107,9 @@ tf-collapsable-panes. <script> Polymer({ - is: "tf-histogram-dashboard", + is: "tf-distribution-dashboard", behaviors: [ - TF.Dashboard.ReloadBehavior("tf-obsolete-histogram-chart"), + TF.Dashboard.ReloadBehavior("tf-distribution-chart"), TF.Backend.Behavior, ], properties: { diff --git a/tensorflow/tensorboard/components/tf-globals/globals.ts b/tensorflow/tensorboard/components/tf-globals/globals.ts index 29e4a143e7..1e908ec034 100644 --- a/tensorflow/tensorboard/components/tf-globals/globals.ts +++ b/tensorflow/tensorboard/components/tf-globals/globals.ts @@ -16,7 +16,7 @@ limitations under the License. /* tslint:disable:no-namespace */ module TF.Globals { // The names of TensorBoard tabs. - export var TABS = ['events', 'images', 'audio', 'graphs', 'histograms']; + export var TABS = ['events', 'images', 'audio', 'graphs', 'distributions']; // If true, TensorBoard stores its hash in the URI state. // If false, tab switching in TensorBoard will not update location hash, diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/rebin.ts b/tensorflow/tensorboard/components/tf-histogram-dashboard/rebin.ts deleted file mode 100644 index 92a6b12f45..0000000000 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/rebin.ts +++ /dev/null @@ -1,43 +0,0 @@ -module TF.Histogram { - /** - * Re-bins histogram data into uniform-width bins. Assumes a uniform - * distribution of values in given bins. - * - * @param bins - Original histogram data. - * @param numberOfBins Number of uniform-width bins to split the data into. - * @return Re-binned histogram data. Does not modify original data, - * returns a new array. - */ - export function rebinHistogram( - bins: TF.Backend.HistogramBin[], numberOfBins: number) { - if (bins.length === 0) { - return []; - } - - var oldBinsXExtent = [ - d3.min(bins, function(old: any) { return old.x; }), - d3.max(bins, function(old: any) { return old.x + old.dx; }) - ]; - - var newDx: number = (oldBinsXExtent[1] - oldBinsXExtent[0]) / numberOfBins; - - var newBins: TF.Backend.HistogramBin[] = - d3.range(oldBinsXExtent[0], oldBinsXExtent[1], newDx) - .map(function(newX) { - - // Take the count of each existing bin, multiply it by the - // proportion of overlap with the new bin, then sum and store as - // the count for new bin. If no overlap, will add zero, if 100% - // overlap, will include full count into new bin. - var newY = d3.sum(bins.map(function(old) { - var intersectDx = Math.min(old.x + old.dx, newX + newDx) - - Math.max(old.x, newX); - return (intersectDx > 0) ? (intersectDx / old.dx) * old.y : 0; - })); - - return {x: newX, dx: newDx, y: newY}; - }); - - return newBins; - } -} diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/test/index.html b/tensorflow/tensorboard/components/tf-histogram-dashboard/test/index.html deleted file mode 100644 index c645f7251b..0000000000 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/test/index.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<html> -<head> - <meta charset="utf-8"> - <script src="../../web-component-tester/browser.js"></script> - <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script> - <link rel="import" href="../../tf-imports/d3.html"> -</head> -<body> - <script src="../rebin.js"></script> - <script src="rebinTests.js"></script> -</body> -</html> diff --git a/tensorflow/tensorboard/components/tf-histogram-dashboard/test/rebinTests.ts b/tensorflow/tensorboard/components/tf-histogram-dashboard/test/rebinTests.ts deleted file mode 100644 index 661ba75b54..0000000000 --- a/tensorflow/tensorboard/components/tf-histogram-dashboard/test/rebinTests.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the 'License'); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an 'AS IS' BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -module TF.Histogram { - let assert = chai.assert; - - describe('Rebin', function() { - - var assertHistogramEquality = function(h1, h2) { - h1.forEach(function(b1, i) { - var b2 = h2[i]; - assert.closeTo(b1.x, b2.x, 1e-10); - assert.closeTo(b1.dx, b2.dx, 1e-10); - assert.closeTo(b1.y, b2.y, 1e-10); - }); - }; - - // - // Rebinning - // - - it('Returns an empty array if you don\'t have any bins', - function() { assert.deepEqual(rebinHistogram([], 10), []); }); - - it('Collapses two bins into one.', function() { - var histogram = [ - {x: 0, dx: 1, y: 1}, - {x: 1, dx: 1, y: 2} - ]; - var oneBin = [ - {x: 0, dx: 2, y: 3} - ]; - assertHistogramEquality(rebinHistogram(histogram, 1), oneBin); - }); - - it('Splits one bin into two.', function() { - var histogram = [ - {x: 0, dx: 1, y: 3} - ]; - var twoBin = [ - {x: 0, dx: 0.5, y: 1.5}, - {x: 0.5, dx: 0.5, y: 1.5} - ]; - assertHistogramEquality(rebinHistogram(histogram, 2), twoBin); - }); - - it('Regularizes non-uniform bins.', function() { - var histogram = [ - {x: 0, dx: 2, y: 3}, - {x: 2, dx: 3, y: 3}, - {x: 5, dx: 1, y: 1} - ]; - var twoBin = [ - {x: 0, dx: 3, y: 4}, - {x: 3, dx: 3, y: 3} - ]; - assertHistogramEquality(rebinHistogram(histogram, 2), twoBin); - }); - - }); -} diff --git a/tensorflow/tensorboard/components/tf-tensorboard/tf-tensorboard.html b/tensorflow/tensorboard/components/tf-tensorboard/tf-tensorboard.html index d841562bad..953f6474a6 100644 --- a/tensorflow/tensorboard/components/tf-tensorboard/tf-tensorboard.html +++ b/tensorflow/tensorboard/components/tf-tensorboard/tf-tensorboard.html @@ -7,7 +7,7 @@ <link rel="import" href="../paper-header-panel/paper-header-panel.html"> <link rel="import" href="../tf-globals/tf-globals.html"> <link rel="import" href="../tf-event-dashboard/tf-event-dashboard.html"> -<link rel="import" href="../tf-histogram-dashboard/tf-histogram-dashboard.html"> +<link rel="import" href="../tf-distribution-dashboard/tf-distribution-dashboard.html"> <link rel="import" href="../tf-image-dashboard/tf-image-dashboard.html"> <link rel="import" href="../tf-audio-dashboard/tf-audio-dashboard.html"> <link rel="import" href="../tf-graph-dashboard/tf-graph-dashboard.html"> @@ -90,11 +90,11 @@ allows the user to toggle between various dashboards. ></tf-graph-dashboard> </template> - <template is="dom-if" if="[[_modeIsHistograms(mode)]]"> - <tf-histogram-dashboard - id="histograms" + <template is="dom-if" if="[[_modeIsDistributions(mode)]]"> + <tf-distribution-dashboard + id="distributions" backend="[[_backend]]" - ></tf-histogram-dashboard> + ></tf-distribution-dashboard> </template> </div> </paper-header-panel> @@ -227,8 +227,8 @@ allows the user to toggle between various dashboards. _modeIsGraphs: function(mode) { return mode === "graphs"; }, - _modeIsHistograms: function(mode) { - return mode === "histograms"; + _modeIsDistributions: function(mode) { + return mode === "distributions"; }, selectedDashboard: function() { var dashboard = this.$$("#" + this.mode); |