
Then it predicts a $ y $ value for the unseen $ x $ value 20 and updates theĭOM to display the prediction. (y = 2x - 1)Ĭonst xs = tf.tensor2d(, ) Ĭonst ys = tf.tensor2d(, ) Generate some synthetic data for training. $ x $ and $ y $ values that satisfy the equation $ y = 2x - 1 $. The exact number will vary, but it should be close to 39. You should see a page title and beneath that a number like 38.31612014770508.

To complete this tutorial, you need the following installed in your development To get started with TensorFlow.js by training a minimal model in the browser and

Learning models in the web browser and in Node.js. TensorFlow.js is a JavaScript library for training and deploying machine
