name: op-synth-bernoulli
description: Bernoulli samples emitting 0 or 1 with probability p; pairs with packed_bool or unsigned int fields.
kind: operator
category: SYNTH
operator: bernoulli
type: reference
applies_to: inspect, predict, manifest
examples_tags: [synth, proportion-analysis]
Synth distributions emit per-row values; no Response.Components. No MCP tool runs synth: the CLI (pulse synth from-schema) or Pulse.Synth does (synthetic-data).
Use when
Draws a yes/no value per row: 1 with a chosen chance p and 0 otherwise, such as whether a customer churned.
Questions it answers:
- How do I mark 12% of synthetic customers as churned?
- How do I generate a random true/false flag?
Use something else:
weighted_categoricalwhen there are more than two outcomes.set_bernoulliwhen each row can tick several options.constantwhen every row should get the same value.
Params
| Name | Type | Default | Description |
|---|---|---|---|
p | float | 0.5 | Probability of emitting 1; must lie in [0, 1]. |
Inputs
Field type: — packed_bool (1 bit per row), unsigned int (u4/u8/u16/u32/u64), or f32/f64.
Output
Per-row 1.0 with probability p, else 0.0; cast to the declared field type at write time.
Contract
- Applies to:
bool,numericfields.
Gotchas
- The only honest marginal for a
packed_bool.profile createreconstructs everypacked_boolasbernoulliwithp= observed mean, ahead of--fit-shape. A continuous marginal cannot round-trip through one bit: the writer thresholds it at 0.5, and a thresholded clamped normal reproduces the wrong prevalence. - A modelled
bernoullitarget is a PROBIT:P(1 | row) = Φ((μ − Φ⁻¹(1−p)) / σ). Coefficients order rows and hold the marginal exactly; they are NOT probability changes. The fidelitymodelssection scores these on the interval-midpoint probit score, not a latent inversion. poutside[0, 1]→SERVICE_VALIDATIONbefore any row is written.pof exactly 0 or 1 is legal and exact but has zero variance, so a model on that target is dropped with a warning.- For
> 2experiment arms useweighted_categorical. - Observed
p_hatconverges atO(1/sqrt(n))— small cohorts diverge from declaredp. - Same spec and seed ⇒ the same rows.