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

Function loss

polynomial-regression-core/index.js:80–84  ·  view source on GitHub ↗
(prediction, labels)

Source from the content-addressed store, hash-verified

78 * labels is a tensor with the y values the model should have predicted.
79 */
80function loss(prediction, labels) {
81 // Having a good error function is key for training a machine learning model
82 const error = prediction.sub(labels).square().mean();
83 return error;
84}
85
86/*
87 * This will iteratively train our model.

Callers 1

trainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected