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-profile-similarity
description: Per-row similarity to a target profile — correlation, cosine or a set similarity across a vector's members, against a literal, label-map or registered reference.
kind: operator
category: ATTR
operator: ATTR_PROFILE_SIMILARITY
type: reference
applies_to: process, compose, predict
examples_tags: [feature-engineering, multivariate, streaming-friendly]

Use when

Adds to every row how closely its related fields match a target profile: an ideal pattern, a benchmark, or its own segment target.

Questions it answers:

  • How closely does each respondent’s brand ratings follow the ideal loyalist profile?
  • How similar is each store’s channel mix to its region’s target mix?

Use something else:

  • ATTR_VEC_DISTANCE when you want how far apart the values are rather than how alike the pattern is.

Params

  • metric — similarity only: correlation, cosine, jaccard, dice, overlap. Default from the vector’s kind (scale → correlation); none → PULSE_VECTOR_METRIC_REQUIRED. A distance → PULSE_VECTOR_METRIC_UNKNOWN, details.use = ATTR_VEC_DISTANCE.
  • reference (required) — […] (member order), {label: value}, {table, key} or {table, key_field} (categorical or u4…u64, by base-10 form).
  • min_valid — fewest complete pairs, default 1; below → null.
  • labels — inline fields only.

Slot: exactly one of vector (a vectors entry) / fields; no field.

Inputs

Members: u4…u64, f32/f64; source columns only.

Output

One f64 per record; null below min_valid or with no profile.

Components

Floor {n, n_null} + n_reference_missing, n_domain_invalid. Mergeable.

Gotchas

  • Matched BY LABEL, never position: wrong labels / length → PULSE_VECTOR_REFERENCE_MISMATCH at predict.
  • A null or profile-less key_field row is null and warns PULSE_VECTOR_REFERENCE_MISSING (n_key_null, n_key_unmatched); a domain violation PULSE_VECTOR_METRIC_DOMAIN. Once per slot; strict does not escalate.
  • Row-local: streams, fuses; weight ignored.

See