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-log
description: Per-row log1p(x) of a numeric field into one derived field. Standard skew-tamer.
kind: operator
category: FEAT
operator: FEAT_LOG
type: reference
applies_to: process, compose, predict
examples_tags: [feature-engineering, distribution-shape, pre-filter, streaming-friendly]

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

Use when

Adds a field holding the natural log of 1 + the value, which pulls in a long tail of large values so a skewed field is easier to model.

Questions it answers:

  • Can I tame the long tail of customer spend before fitting a model on it?
  • How does income look on a log-like scale, where for large values doubling counts about the same everywhere?

Params

None; params is unused.

Inputs

field (required) — admitted types: see ## Contract; decimal128 reads as its float64 echo, packed_bool as 0/1.

Output

One derived field at label (default LOG_<field>). Formula log1p(x) = ln(1 + x) — the +1 shift keeps x=0 -> 0 instead of -inf. Bit-identical to the formula attribute’s log1p(x) on every machine (log(x + 1) is not: it rounds 1 + x first).

Reading the output

  • value: The natural log of 1 + the value: ln(1 + x). 0 reads 0, e - 1 (about 1.72) reads 1, 9 reads about 2.3 and 99 about 4.6; each step of about 0.69 is a doubling of 1 + x, so equal steps are equal ratios of 1 + x, not equal amounts.
    • Sign: positive means the original value is above 0; negative means the original value is between -1 and 0.
    • Caveat: A value of -1 or less has no log and reads missing, with no error raised: count the missing rows before trusting a model built on the field.
    • Caveat: A missing input gives a missing output.

Contract

  • Types (field): date, datetime, decimal128, f32, f64, packed_bool, 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

  • Inputs with x <= -1 (where 1 + x <= 0) produce a null, not an error — the rest of the cohort keeps going.
  • Null inputs propagate to null outputs.
  • Streamable per-row — pairs cleanly with online aggregators downstream.
  • Runs before filters: a range filter on the output references LOG_<field> (default label).

See