Playground/ AI & Machine Learning/ Prediction Playground
🤖 AI & Machine Learning

Prediction Playground

Fit a straight line through two columns, then predict a new value.

Demonstration using a representative 20-row sample dataset: a simple linear fit, not a production ML model.

Predicted Y: –

What is happening?

This fits the simplest possible model (a straight line, y = slope×x + intercept) using ordinary least squares. R² (0 to 1) says how much of Y's variation the line actually explains; a low R² means the line is a weak predictor even if it's the best straight line available. This is a teaching tool, not a forecasting system: real prediction problems need more than one input and a lot more validation.

Under the Hood
X / Y column selection ↓ Ordinary least squares fit ↓ Line drawn over the scatter, R² reported ↓ Custom X evaluated through the fitted line

Inputs

  • 5 numeric columns, 20 rows

Processing

  • Least-squares linear regression
  • R² goodness of fit

Output

  • Fitted line + equation
  • Live prediction for a custom X

Technology

  • Vanilla JavaScript
  • Hand-built inline SVG chart

Explore another experiment

More Playground experiments are on the way.