MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / renderEvaluateTable

Function renderEvaluateTable

iris-fitDataset/ui.js:119–146  ·  view source on GitHub ↗
(xData, yTrue, yPred, logits)

Source from the content-addressed store, hash-verified

117}
118
119export function renderEvaluateTable(xData, yTrue, yPred, logits) {
120 const tableBody = document.getElementById('evaluate-tbody');
121
122 for (let i = 0; i < yTrue.length; ++i) {
123 const row = document.createElement('tr');
124 for (let j = 0; j < 4; ++j) {
125 const cell = document.createElement('td');
126 cell.textContent = xData[4 * i + j].toFixed(1);
127 row.appendChild(cell);
128 }
129 const truthCell = document.createElement('td');
130 truthCell.textContent = IRIS_CLASSES[yTrue[i]];
131 row.appendChild(truthCell);
132 const predCell = document.createElement('td');
133 predCell.textContent = IRIS_CLASSES[yPred[i]];
134 predCell.classList =
135 yPred[i] === yTrue[i] ? ['correct-prediction'] : ['wrong-prediction'];
136 row.appendChild(predCell);
137 const logitsCell = document.createElement('td');
138 const exampleLogits =
139 logits.slice(i * IRIS_NUM_CLASSES, (i + 1) * IRIS_NUM_CLASSES);
140 logitsToSpans(exampleLogits).map(logitSpan => {
141 logitsCell.appendChild(logitSpan);
142 });
143 row.appendChild(logitsCell);
144 tableBody.appendChild(row);
145 }
146}
147
148export function wireUpEvaluateTableCallbacks(predictOnManualInputCallback) {
149 const petalLength = document.getElementById('petal-length');

Callers

nothing calls this directly

Calls 1

logitsToSpansFunction · 0.70

Tested by

no test coverage detected