Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

name: op-feat-poly
description: Per-row polynomial expansion x^2..x^Degree of a numeric field — the basis for a polynomial regression.
kind: operator
category: FEAT
operator: FEAT_POLY
type: reference
applies_to: process, compose, predict
examples_tags: [feature-engineering, polynomial, pre-filter, streaming-friendly]

Feature operators write derived fields before filters run; no Response.Components.

Use when

Adds fields holding the value squared, cubed and so on up to a chosen power, so a straight-line model can bend into a curve.

Questions it answers:

  • Does satisfaction rise with tenure and then level off?
  • Is the effect of temperature on yield curved rather than straight?

Use something else:

  • REG_OLS when you want to fit the curve itself, not just build its fields.

Params

NameTypeDefaultDescription
degreeint(required)>= 2 AND <= 10. Degree 1 is the source field; reference it directly downstream.

Inputs

field (required) — numeric (types: ## Contract); decimal128 reads as its float64 echo.

Output

degree − 1 derived fields <prefix>_<k> for k = 2..degree, prefix default <field>_poly (override via label). Each holds x^k by repeated multiplication. The source field is untouched, so a linear regression over {x, x_poly_2, x_poly_3, …} is the polynomial-regression basis.

Reading the output

  • value.*: One field per power k from 2 up to the degree, named <prefix>_<k> (prefix is the label, by default <field>_poly), each holding the value raised to that power: x_poly_2 is x squared, x_poly_3 is x cubed. There is no power-1 field; the original field is it.
    • Caveat: A single power field means little alone: the curve shows in a model’s coefficients on x and its powers together, and those change when the field is centred first.
    • Caveat: Even powers lose the sign: x = -3 and x = 3 both give 9 in the squared field.

Contract

  • Types (field): date, decimal128, f32, f64, u16, u32, u4, u64, u8; any other scalar type is PULSE_FIELD_TYPE_UNSUPPORTED.
  • Weight: not read; a weight in force is skipped.
  • Streaming: streamable.

Gotchas

  • degree outside [2, 10] → PROCESSING_CONFIG.
  • OVERFLOW WITHOUT STANDARDISATION: x^10 at |x| = 100 is already 1e20. Centre / standardise first; there is no orthogonal basis.
  • Null inputs → null on every emitted column. Streamable per-row.

See