Free browser-based ML tool

Polynomial Regression Calculator

Fit a polynomial curve to CSV data, compare holdout error, inspect residuals, and export predictions with reproducible JavaScript and Python code.

Free to useNo upload or sign-inRuns entirely in your browser
Live calculationPowered by @kanaries/ml

Data stays in this tab. Limits: 2,000 rows, 30 columns; customer clustering: 500 customers and 12 features.

Choose columns, then calculate. Changing an input hides the previous result until you run again.

Preview input (15 rows)
xy
02
14
210
320
434
552
674
7100
8130
9164
10202
11244
12290
13340
14394

Fit a curve and inspect what it misses

Choose different X and Y columns, set a degree from 1 to 6, and calculate. The curve, equation, fitted predictions and residual chart describe a least-squares model fitted with @kanaries/ml. The residual is observed minus predicted Y. At least ten rows are required for the separate holdout comparison.

Use validation to compare degree

Training error often falls as polynomial degree increases. Holdout error measures how a separate fitted model performs on excluded rows. Compare degrees on the same data and split, then favor a simpler model when performance is similar. A constant target has undefined R²; the tool reports that explicitly.

Reproduce the full transformation

The calculation centers and scales X before generating polynomial powers. JavaScript expands those features and uses Linear.LinearRegression; Python combines StandardScaler, PolynomialFeatures and LinearRegression. The code panel includes current data and reproduces the holdout split. Keep full-precision code for reproduction rather than copying the rounded display equation.

Work through a practical example

How to Choose a Polynomial Degree Without Overfitting explains the input, assumptions and expected output. Continue with How Outliers Change a Regression Line to compare methods and interpret results.

Frequently asked questions

Questions about polynomial regression calculator

How is validation calculated?

Every fifth row, starting with the first data row, is held out. A separate model fits scaling and coefficients on the remaining rows. The displayed curve is fitted to all rows.

What does the equation use?

The polynomial is expressed in z = (x - center) / scale to improve numerical conditioning. Keep this transformation with the coefficients when predicting.

Can I use this for a time-series forecast?

The fixed row split is intended for exploratory comparisons. For time series, use a chronological validation procedure. High-degree polynomials can extrapolate poorly outside the observed range.

Is my CSV uploaded?

No. Parsing, fitting and chart rendering run in this browser tab. Files are limited to 1 MB, 2,000 rows and 30 columns; clustering also limits the input to 500 customers and 12 features.

Powered by @kanaries/ml — the scikit-learn-style ML library for JavaScriptnpmGitHub