Using TensorFlow.js and p5js to fit a curve to a synthetic dataset


Click here to see a short demo animation (as an animated GIF)

This example uses TensorFlow.js to build a model and learn its coefficients. The basic idea is very similar to the tutorial Fitting a Curve to Synthetic Data which is a part of the official TFJS documentation but this specific implementation is different in many aspects.

To run the code locally, you need the following dependencies installed:

  • Node.js version 8.9 or higher
  • NPM CLI
$ git clone https://github.com/atorov/ml-tfjs-fitting-curve
$ cd ml-tfjs-fitting-curve
$ npm i
$ npm start

The code is available here: https://github.com/atorov/ml-tfjs-fitting-curve

2 Likes