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

Function getLoss

src/playground.ts:840–849  ·  view source on GitHub ↗
(network: nn.Node[][], dataPoints: Example2D[])

Source from the content-addressed store, hash-verified

838}
839
840function getLoss(network: nn.Node[][], dataPoints: Example2D[]): number {
841 let loss = 0;
842 for (let i = 0; i < dataPoints.length; i++) {
843 let dataPoint = dataPoints[i];
844 let input = constructInput(dataPoint.x, dataPoint.y);
845 let output = nn.forwardProp(network, input);
846 loss += nn.Errors.SQUARE.error(output, dataPoint.label);
847 }
848 return loss / dataPoints.length;
849}
850
851function updateUI(firstStep = false) {
852 // Update the links visually.

Callers 2

oneStepFunction · 0.85
resetFunction · 0.85

Calls 1

constructInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…