.. _auto_curves_fit_polynomial:
*FIT THE CURVES WITH POLYNOMIALS*
=================================
Fits one or more input curves with a polynomial of selectable order (1–5) using least-squares regression, optionally restricting the fit to a user-defined x-range and resampling the result to a specified number of points. Use this worker to smooth noisy curves, extract trend lines, or prepare regularised representations of test or simulation data for downstream processing.
When to use
-----------
Classification: **process**.
Tagged: ``curve_fit``, ``digitize``, ``force_origin``, ``knot_adjust``, ``least_squares``, ``optimize``, ``polynomial``, ``regression``.
Inputs
------
.. list-table::
:header-rows: 1
:widths: 20 20 20 20 20 20
* - Label
- ID
- Type
- Default
- Required
- Description
* - Curves
- curves
- vector
- —
- ✓
- One or more input curves (x/y vector pairs) to be fitted; accepts multiple curve objects passed as a vector collection.
* - Order
- order
- list
- 1
- ✓
- Polynomial degree for the fit — integer 1 (linear) through 5 (quintic); defaults to 1 (linear).
* - DIG POINTS
- digitize
- list
- -1
-
- Number of evenly-spaced points used to re-digitise the fitted curve for output; set to -1 (default) to keep the original x-spacing of the input curve.
* - XMIN - Optional
- xmi_n-optional
- scalar
- 0
-
- Lower bound of the x-range over which the polynomial is fitted and evaluated; leave at 0 (default) to use the curve's own minimum x value.
* - XMAX - Optional
- xma_x-optional
- scalar
- 0
-
- Upper bound of the x-range over which the polynomial is fitted and evaluated; leave at 0 (default) to use the curve's own maximum x value.
* - Step
- step-optional
- scalar
- 0.001
-
- X-axis step size used when resampling the output curve; default is 0.001 — only active when digitize is not -1.
* - Remove Intercept
- remove_intercept
- list
- no
-
- Line is rotated about the mean point until it passes through the origin. For segmented linear, the window_size is used as number of knots whose positions are to be optimized
* - Window Size
- window_size
- scalar
- —
-
- Percentage of points to use over which the regression is built. By default the entire curve is used as the window size
* - Type Of Fit
- optimize
- list
- no
-
- Type of fit
* - 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
- r2_cutoff
- 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 100 points while searching for Knots
- limit_to_100_points
- list
- no
-
- By default all points are used while searching. This option may help reduce execution time
* - 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
-
- When Adjust Knots is turned on, number of adjustments is determined by this number
Outputs
-------
.. list-table::
:header-rows: 1
:widths: 20 20 20 20
* - Label
- ID
- Type
- Description
* - curves_fit_polynomial_output_1
- curves_fit_polynomial_output_1
- vector
- Collection of polynomial-fitted curves (one per input curve), each containing the evaluated polynomial as an x/y vector at the requested resolution and x-range.
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=curves_fit_polynomial `_
.. raw:: html
Auto-generated from transformation schema. Worker id: curves_fit_polynomial. Schema hash: 6cedb2847032. Hand-curated docs in workerexamples/ override this page when present.