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-synth-mixture
description: Mixture-of-normals samples — per-row component draw by weight, then a Gaussian from that component; reproduces bimodal/multimodal shapes.
kind: operator
category: SYNTH
operator: mixture
type: reference
applies_to: inspect, predict, manifest
examples_tags: [synth, distribution-shape]

Synth distributions emit per-row values; no Response.Components.

Use when

Draws from two or more bell curves blended by weight, for data with several peaks, like weekday and weekend order sizes.

Questions it answers:

  • How do I simulate a column with two separate peaks?
  • How do I generate order sizes where small and bulk orders form distinct groups?

Use something else:

  • normal when one peak is enough.
  • lognormal when there is one peak with a long right tail.

Params

NameTypeDefaultDescription
meanslist[float]requiredPer-component means; length sets the component count (>= 2).
stdslist[float]requiredPer-component std devs; each > 0, length must match means.
weightslist[float]uniformMixing weights; length must match means, non-negative, sum > 0.

Selection mirrors weighted_categorical: draw an index off the cumulative-weight table, then draw N(means[i], stds[i]²).

Inputs

Field type: — numeric u4/u8/u16/u32/u64, f32/f64, decimal128. Cast at write time.

Output

Per-row float64 from the selected component’s Gaussian. No min/max clamp — use constraints for hard bounds.

Gotchas

  • Fewer than 2 means → SERVICE_VALIDATION (use normal for one component).
  • stds/weights length mismatch, any std <= 0, or negative/all-zero weights → SERVICE_VALIDATION.
  • profile create --fit-shape fits and emits mixture automatically, but fixed at 2 components via BIC-vs-normal selection (internal/synth/shape.go) — no sweep over component count. 3+ components are hand-written only.
  • Excluded from correlations: unmodelled mixtures are pre-claimed before the copula bids, modelled ones refused there permanently; a modelled mixture correlates through residual_correlations instead.
  • Composes with --fit-models: a shape-fitted target draws through its model with the mixture as Q via a fixed-count bisection inverse, so coefficients are LATENT-scale — non-linear in value space. See synthetic-data.

See