MCPcopy
hub / github.com/tensorflow/playground / updateUI

Function updateUI

src/playground.ts:851–887  ·  view source on GitHub ↗
(firstStep = false)

Source from the content-addressed store, hash-verified

849}
850
851function updateUI(firstStep = false) {
852 // Update the links visually.
853 updateWeightsUI(network, d3.select("g.core"));
854 // Update the bias values visually.
855 updateBiasesUI(network);
856 // Get the decision boundary of the network.
857 updateDecisionBoundary(network, firstStep);
858 let selectedId = selectedNodeId != null ?
859 selectedNodeId : nn.getOutputNode(network).id;
860 heatMap.updateBackground(boundary[selectedId], state.discretize);
861
862 // Update all decision boundaries.
863 d3.select("#network").selectAll("div.canvas")
864 .each(function(data: {heatmap: HeatMap, id: string}) {
865 data.heatmap.updateBackground(reduceMatrix(boundary[data.id], 10),
866 state.discretize);
867 });
868
869 function zeroPad(n: number): string {
870 let pad = "000000";
871 return (pad + n).slice(-pad.length);
872 }
873
874 function addCommas(s: string): string {
875 return s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
876 }
877
878 function humanReadable(n: number): string {
879 return n.toFixed(3);
880 }
881
882 // Update loss and iteration number.
883 d3.select("#loss-train").text(humanReadable(lossTrain));
884 d3.select("#loss-test").text(humanReadable(lossTest));
885 d3.select("#iter-number").text(addCommas(zeroPad(iter)));
886 lineChart.addDataPoint([lossTrain, lossTest]);
887}
888
889function constructInputIds(): string[] {
890 let result: string[] = [];

Callers 4

makeGUIFunction · 0.85
updateHoverCardFunction · 0.85
oneStepFunction · 0.85
resetFunction · 0.85

Calls 9

reduceMatrixFunction · 0.90
updateWeightsUIFunction · 0.85
updateBiasesUIFunction · 0.85
updateDecisionBoundaryFunction · 0.85
humanReadableFunction · 0.85
addCommasFunction · 0.85
zeroPadFunction · 0.85
updateBackgroundMethod · 0.80
addDataPointMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…