(prediction, labels)
| 78 | * labels is a tensor with the y values the model should have predicted. |
| 79 | */ |
| 80 | function 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. |