FIT THE CURVE WITH POLYNOMIALS

Fits a 2-D curve with a polynomial of a specified (or automatically selected) order using least-squares regression. Supports optional x-range clipping, digitization, sliding-window fitting, R² optimisation, and origin-forcing. Use this worker to smooth noisy curves or extract a compact polynomial representation for further processing.

When to use

Classification: process.

Tagged: curve_fit, digitize, least_squares, optimize, polynomial_fit, r2, regression, sliding_window.

Inputs

Label ID Type Default Required Description
Curve curve vector Input curve (x-y vector) to be fitted; must be a valid d3VIEW curve object — this is the only required input.
Order order scalar 1 Polynomial order for the fit (integer 1–9, default 1); pass “auto” to select the order with the highest R², or “auto_parsimony” to select the lowest order whose R² is within 0.005 of the best — recommended for noisy data to avoid overfitting. When optimize=yes this becomes the maximum order to search.
DIG POINTS digitize list -1   Number of evenly-spaced points to which the input curve is re-sampled before fitting (options: -1 = no re-sampling, 10/100/200/400/1000; default -1); increase to normalise high-density or irregular curves.
XMIN - Optional xmi_n-optional scalar 0   Minimum x-value of the fitting domain (default 0, meaning use the curve’s natural start); set to clip the fit to a sub-range.
XMAX - Optional xma_x-optional scalar 0   Maximum x-value of the fitting domain (default 0, meaning use the curve’s natural end); set in conjunction with XMIN to restrict the polynomial to a specific interval.
Step step-optional scalar 0.001   X-step size used when generating the output fitted curve (default 0.001); reduce for smoother output or increase for coarser/faster results.
Remove Intercept remove_intercept list no   Whether to suppress the constant term (intercept) in the fitted polynomial — “yes” or “no” (default “no”); set to “yes” when the fitted curve must pass through y=0 at x=0.
Window Size window_size scalar   Number of x-points in each sliding window for a piecewise/local polynomial fit (default null = global fit over the whole curve); set to a positive integer to enable local fitting.
Type Of Fit optimize list no   When set to “yes”, iteratively increments the polynomial order up to the value of order, accepting each increment only when R² improves by more than per_inc (default “no”).
Smallest Segment To Consider For Fit increment_ratio text 0.01   Ratio of points in the curve to use for as increments for the fit
R2 Cut Off For Fit Optimization r2cutoff text 0.995   When the R2 of a fit is below this to the previous fit, the fit considered goog
Force Zero Origin force_zero_origin list no   This option fores the fit to pass through 0,0 point
Limit to certain number of points while searching for Knots limit_to_100_points list no   Limit the input data to a maximum of 100 points before fitting — “yes” or “no” (default “no”); can speed up fitting on very dense curves with minimal accuracy loss.
Adjust Knots adjust_knots list no   In some instances, the auto-knots might find knots points that could create noise in the fit. This option helps to re-adjust those knots to minimize noise
Number of Knot Adjustments num_adjusts text 3   Maximum number of auto-adjustment iterations performed when auto_adjusts=yes (default 3); increase for tighter convergence at the cost of additional compute time.

Outputs

Label ID Type Description
curve_fit_polynomial_output_1 curve_fit_polynomial_output_1 vector Fitted polynomial curve as an x-y vector evaluated at the specified step size over the fitting domain; ready for downstream curve comparison, visualisation, or further transformation.

Disciplines

  • ai_ml.supervised.regression
  • data.curve.transform

Runnable example

A runnable example is registered for this worker. Open the example workflow on the d3VIEW canvas: /api/workflow/example?id=curve_fit_polynomial


Auto-generated from transformation schema. Worker id: curve_fit_polynomial. Schema hash: 74d5d9e9231f. Hand-curated docs in workerexamples/ override this page when present.