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

Function drawDatasetThumbnails

src/playground.ts:993–1025  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

991}
992
993function drawDatasetThumbnails() {
994 function renderThumbnail(canvas, dataGenerator) {
995 let w = 100;
996 let h = 100;
997 canvas.setAttribute("width", w);
998 canvas.setAttribute("height", h);
999 let context = canvas.getContext("2d");
1000 let data = dataGenerator(200, 0);
1001 data.forEach(function(d) {
1002 context.fillStyle = colorScale(d.label);
1003 context.fillRect(w * (d.x + 6) / 12, h * (d.y + 6) / 12, 4, 4);
1004 });
1005 d3.select(canvas.parentNode).style("display", null);
1006 }
1007 d3.selectAll(".dataset").style("display", "none");
1008
1009 if (state.problem === Problem.CLASSIFICATION) {
1010 for (let dataset in datasets) {
1011 let canvas: any =
1012 document.querySelector(`canvas[data-dataset=${dataset}]`);
1013 let dataGenerator = datasets[dataset];
1014 renderThumbnail(canvas, dataGenerator);
1015 }
1016 }
1017 if (state.problem === Problem.REGRESSION) {
1018 for (let regDataset in regDatasets) {
1019 let canvas: any =
1020 document.querySelector(`canvas[data-regDataset=${regDataset}]`);
1021 let dataGenerator = regDatasets[regDataset];
1022 renderThumbnail(canvas, dataGenerator);
1023 }
1024 }
1025}
1026
1027function hideControls() {
1028 // Set display:none to all the UI elements that are hidden.

Callers 2

makeGUIFunction · 0.85
playground.tsFile · 0.85

Calls 1

renderThumbnailFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…