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

Function plotLoss

mnist/ui.js:65–77  ·  view source on GitHub ↗
(batch, loss, set)

Source from the content-addressed store, hash-verified

63const accuracyLabelElement = document.getElementById('accuracy-label');
64const lossValues = [[], []];
65export function plotLoss(batch, loss, set) {
66 const series = set === 'train' ? 0 : 1;
67 lossValues[series].push({x: batch, y: loss});
68 const lossContainer = document.getElementById('loss-canvas');
69 tfvis.render.linechart(
70 lossContainer, {values: lossValues, series: ['train', 'validation']}, {
71 xLabel: 'Batch #',
72 yLabel: 'Loss',
73 width: 400,
74 height: 300,
75 });
76 lossLabelElement.innerText = `last loss: ${loss.toFixed(3)}`;
77}
78
79const accuracyValues = [[], []];
80export function plotAccuracy(batch, accuracy, set) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected