TensorFlow.js Linear Fit Lab

Generate a noisy line, then watch TensorFlow.js learn its slope and intercept entirely in your browser.

Synthetic data controls

Quick tips

  • Start with low noise to see the loss approach zero.
  • Increase noise and epochs to watch the optimizer settle.
  • Training runs entirely in the main thread via TensorFlow.js.

Data & fit preview

Parameters

Ground truth slope:

Ground truth intercept:

Learned slope:

Learned intercept:

Final loss:

Training log