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-attr-reg-predict
description: Per-row score from a bound model (a compose `fits` entry or a loaded `models` file) — no refit; whole model or a terms subset.
kind: operator
category: ATTR
operator: ATTR_REG_PREDICT
type: reference
applies_to: compose, predict
examples_tags: [regression, ols, compose]

Use when

Adds to every row the value a model fitted once, elsewhere in the request, predicts for it from the row’s own predictor values.

Questions it answers:

  • How close are the model’s predictions on weeks it was not fitted to (a holdout)?
  • How much of each week’s sales does the TV term of the fitted model account for?

Use something else:

  • ATTR_REG_FITTED when the model should be fitted to these same rows inside the slot.

Params

NameTypeDefaultDescription
fitstring(required)Bound model name.
termslist—Subset of terms, (intercept) opt-in. Absent: whole model.
scaleenumresponseGLM, ordinal, multinomial: response, link.
boundenumpointpoint, lower, upper: ci bound × column. Needs terms = one predictor.
carryoverbooltrueAdstocked-in-model fit: carry (needs order).
orderobject—{field, partition?} of raw spend (regression-order).
outputenum—Ordinal / multinomial column (regression-row-scores).
levelstring—Ordinal level.
categorystring—Multinomial category.

Inputs

  • model predictors — numeric fields or earlier labels, by name
  • label — output name; default ATTR_REG_PREDICT_<fit>

Output

One f64 per record; null when a value read is null, NaN or ±Inf, and on EVERY row when the fit failed on its data (PULSE_FIT_UNAVAILABLE; predict cannot foresee it). Training rows equal the fit’s fitted values bit for bit.

Reading the output

  • value: The target value the named fitted model predicts for the row from the row’s own predictor values: intercept + sum(coefficient * predictor) at the fit’s full precision, in the target’s units — for a GLM on the response scale (the inverse link applied: a probability, a count) unless scale is link. With terms, only the listed terms are summed: that part of the prediction, a contribution in the target’s units (link units for a GLM).
    • Caveat: A coefficient’s confidence bound gives the range of that one term, not a prediction interval for a row.

Contract

  • Types: date, datetime, decimal128, f32, f64, packed_bool, u16, u32, u4, u64, u8 (each column the bound model reads); any other scalar type is PULSE_MODEL_PREDICTOR_NOT_NUMERIC.
  • Weight: not read; a weight in force is skipped.
  • Streaming: streamable.

Gotchas

  • The fit’s predictor list is authoritative: build the same fields (regression-row-scores).
  • A coefficient bound is not a prediction interval. A term with no bound scores null.
  • Row-local (two-pass with order): streams, merges, materializes. Row weight ignored.
  • A registered model scores whole-model (no_scorer without a scorer); save, load, ordinal, multinomial: regression-row-scores. REG_MMM_BAYES alone takes a whole-model bound (mmm-bayes-posterior).

See