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-reg-ols
description: Ordinary least squares with optional l1/l2/elasticnet penalty; covers simple, multiple, ridge, lasso, and elastic-net regression over streaming sufficient statistics.
kind: operator
category: REG
operator: REG_OLS
type: reference
applies_to: process, compose, predict
examples_tags: [regression, ols, streaming-friendly]

Fits ride regressions[i]; no Response.Components.

Use when

Fits a straight-line model that predicts a numeric outcome from one or more numeric predictors, by least squares.

Questions it answers:

  • Which of price, discount and season are associated with weekly sales, holding the others fixed?
  • How much does predicted order value change per extra visit, with the other predictors held fixed?

Use something else:

  • REG_GLM when the outcome is yes/no (0/1) or a count.

Params

Flat keys (params is refused); shared: regression-spec.

NameTypeDefaultDescription
targetfield(required)Response (numeric).
predictors[]field(required)≥1 numeric.
penaltyenum""l1, l2, elasticnet.
alphafloat—Strength, > 0.
l1_ratiofloat—Mix, 0<r<1.
unpenalized[]field—Left unshrunk.
boundsobject—{nonnegative: [...]}: slopes ≥ 0.
interceptbooltruefalse: no intercept.
solverenumqrOr normal.
max_itersint—Penalized cap.
tolfloat—Penalized tolerance.
resampleenum—bootstrap, jackknife.
bootstrap_itersint1000Resample.
jackknife_groupsint—Resample.
jackknife_byfield—Resample.
rng_seedint—Resample.
selectionenum—backward, forward, stepwise.
criterionenum—aic, bic.
conf_levelfloat0.95CI coverage.
vcovboolfalseAdds vcov + correlation.
covarianceobject—Robust SEs.
marginsobject—Effects = βs (regression-margins).
collinearityobject—VIFs (regression-collinearity).
weightslot weight—null opts out; WLS.
multiplicityobject—p-values join a family; adds p_adjusted.
holdoutexpr—Held-out rows → holdout.
savestring—Writes a model file.
orderobject—Row order.
namestring—Result / model name.

Inputs

See ## Contract; null / NaN / ±Inf drops the row.

Output

coefficients["(intercept)"] + per-predictor βs; std_errors, p_values (Student-t); ci_lower / ci_upper, df, conf_level; r2, adj_r2, residual_std_err, two_log_lik / aic, n_obs (+ weighted sum_weights). Robust covariance adds a covariance echo.

Reading the output

  • coefficients.*: The difference in the outcome’s expected value between rows one unit apart on this predictor, holding the other predictors fixed, in outcome units per predictor unit (an association, not the effect of changing it).
  • std_errors.*: How much the coefficient would vary from sample to sample; smaller means a more precise estimate. It is the classic standard error, which assumes residuals of constant spread, unless the request’s covariance names a robust one.
  • n_obs: Rows used in the fit, after rows with a null target or predictor were dropped.

Contract

  • Types (target, predictor): date, datetime, decimal128, f32, f64, packed_bool, u16, u32, u4, u64, u8; any other scalar type is PULSE_FIELD_TYPE_UNSUPPORTED.
  • Weight: weighted under frequency and probability weights.
  • Multiplicity: its own multiplicity block (an inherited one never reaches it) adds per-coefficient p_adjusted and significant_adjusted beside the raw p; families request (default), compose (inside Compose).
  • Streaming: streamable.

Gotchas

  • l1 / elasticnet: null SE / p / CI + PULSE_ADVISORY_PENALIZED_INFERENCE_UNDEFINED; use resample. The penalty reads raw units (regression-spec).
  • unpenalized / bounds misuse → PROCESSING_CONFIG; a binding bound: regression-model-options.
  • vcov under l1 / elasticnet, or a robust covariance (buffered) beside penalty / resample / selection / bounds → PROCESSING_REGRESSION_VCOV_UNSUPPORTED.
  • Weighted resample: bootstrap / selection → PULSE_WEIGHT_UNSUPPORTED.
  • Collinear → PROCESSING_REGRESSION_RANK_DEFICIENT / SINGULAR_GRAM: drop one, or l2.
  • Per-row diagnostics: ATTR_REG_*.

See