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

Function predict

polynomial-regression-core/index.js:63–71  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

61 * @return number predicted y value
62 */
63function predict(x) {
64 // y = a * x ^ 3 + b * x ^ 2 + c * x + d
65 return tf.tidy(() => {
66 return a.mul(x.pow(tf.scalar(3, 'int32')))
67 .add(b.mul(x.square()))
68 .add(c.mul(x))
69 .add(d);
70 });
71}
72
73/*
74 * This will tell us how good the 'prediction' is given what we actually

Callers 2

trainFunction · 0.70
learnCoefficientsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected