Skip to content

ump_spec.models.model

module ump-spec

provisional (not yet in the spec) G-DATA-07 is in the gate registry but not yet in the specification’s gate catalogue, so it is not normative.

Model manifest (spec §7), tiers, dependence declaration, acceptance status (§14).

class

class DependenceDeclaration(StrictModel)

Fields

NameTypeDefaultDescription
kindDependenceKind
assumptionLiteral['copula', 'independence'] | NoneNoneRequired when kind is declared_assumption.
notestr | NoneNone

Source: packages/ump-spec/src/ump_spec/models/model.py, line 93

class

class LayerStatus(StrictModel)

Fields

NameTypeDefaultDescription
statusLiteral['untested', 'passed', 'failed']'untested'
metricsdict[str, Any]dict()
report_idstr | NoneNone

Source: packages/ump-spec/src/ump_spec/models/model.py, line 101

class

class AcceptanceStatus(StrictModel)

§14: three layers. Untested is usable with reduced trust; failed is excluded (G-ACC-01).

Fields

NameTypeDefaultDescription
statusAcceptanceStatusValue'untested'
computationLayerStatusLayerStatus()
identificationLayerStatusLayerStatus()
decisionsLayerStatusLayerStatus()
report_idstr | NoneNone
negative_controlboolFalseTrue for MTM: the bar must fail it.
threshold_set_versionstr | NoneNone§14: the threshold-set version the status was earned against.
regrade_bydate | NoneNone§14: date by which the status must be re-run.

Source: packages/ump-spec/src/ump_spec/models/model.py, line 107

class

class CurveParams(StrictModel)

Tier B per-channel curve.

Fields

NameTypeDefaultDescription
channelstr
curve_familyLiteral['hill', 'logistic', 'power', 'neg_exponential']'hill'
paramsdict[str, float]dict()
param_drawsdict[str, list[float]] | NoneNone
adstockdict[str, Any] | NoneNone
input_scalingfloat | NoneNone

Source: packages/ump-spec/src/ump_spec/models/model.py, line 123

class

class SpendGrid(StrictModel)

Tier C declaration. Grid >= 21 points from 0 to 2.5x current spend is proposed (§7).

Fields

NameTypeDefaultDescription
channelstr
multiplierslist[float]
spendlist[float]
contributionlist[float] | NoneNone
contribution_lolist[float] | NoneNone
contribution_hilist[float] | NoneNone
current_spendfloat
max_seen_spendfloat | NoneNone
time_aggregationLiteral['per_week', 'per_flight', 'annual']'annual'
adstock_treatmentLiteral['included', 'excluded', 'unknown']'unknown'
uncertaintyLiteral['draws', 'quantiles', 'none']'none'

Source: packages/ump-spec/src/ump_spec/models/model.py, line 134

class

class SummaryNumber(StrictModel)

Tier D: ROI or mROI at current spend only.

Fields

NameTypeDefaultDescription
channelstr
metricLiteral['roi', 'mroi']
valuefloat
lofloat | NoneNone
hifloat | NoneNone
levelfloat | NoneNone
current_spendfloat | NoneNone

Source: packages/ump-spec/src/ump_spec/models/model.py, line 150

class

class HostedEndpoint(StrictModel)

Tier X.

Fields

NameTypeDefaultDescription
endpoint_urlstr
revisionstr
validated_revisionstr | NoneNone

Source: packages/ump-spec/src/ump_spec/models/model.py, line 217

class

class ModelManifest(ArtifactDoc)

Fields

NameTypeDefaultDescription
namestr
client_idstr | NoneNone
tierTier
familyModelFamily'media_mix'
enginestrin-house frameworks, pymc-marketing, meridian, robyn, vendor:nielsen, stub, …
engine_versionstr | NoneNone
stubboolFalse
adapter_urlstr | NoneNone
applies_toAppliesToAppliesTo()
estimandsdict[str, Estimand]dict()
representationRepresentation'draws'
dependenceDependenceDeclarationlambda: DependenceDeclaration(kind='none')()
acceptanceAcceptanceStatusAcceptanceStatus()
capability_statusCapabilityStatus'sandbox'
capability_manifest_idstr | NoneNone
valid_fromValidityInstant | NoneNoneSpec §7: start of the half-open validity window [valid_from, valid_to), an RFC 3339 instant (UTC, Z, milliseconds). A calendar date reads as midnight UTC.
valid_toValidityInstant | NoneNoneSpec §7: end of the half-open validity window; the model is expired when valid_to <= now. An RFC 3339 instant; a calendar date reads as midnight UTC.
refit_datedate | NoneNone
audit_levelLiteral[1, 2, 3, 4]2
trust_levelint2
vendor_validatedbool | NoneNoneG-VEN-01 outcome for vendor tables.
calibrated_channelslist[str]list()
licence_limitslist[str]list()
dataset_refslist[str]list()
payload_refsdict[str, str]dict()
curveslist[CurveParams]list()
gridslist[SpendGrid]list()
summarieslist[SummaryNumber]list()
endpointHostedEndpoint | NoneNone
run_idstr | NoneNone
noteslist[dict[str, Any]]list()
input_contractInputContract | NoneNoneThe input shape a saved workflow reruns on (optional; checked by G-DATA-07).
rolestr | NoneNoneRole in the acceptance bar, e.g. negative_control (core’s mirror reads it). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
source_typestr | NoneNoneSource type for vendor intake (registries/source_types.yaml). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
intakedict[str, Any] | NoneNoneIntake record for a vendor or summary model: fallbacks applied and mapping. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
data_fetchdict[str, Any] | NoneNoneDataset fetch record the fit used (storage, use, fetch_record). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
certificationdict[str, Any] | NoneNoneCertification requirements and their status (§16). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
acceptance_noteslist[Any] | NoneNoneNotes from the acceptance bar (code, severity, message). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
calibrated_fromdict[str, Any] | NoneNoneThe model version this one was calibrated from, with routes and adjustments. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
response_curvesdict[str, Any] | NoneNoneResponse curves on a spend grid: channels, multipliers, spend grid, values. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
adstock_alpha_drawsdict[str, Any] | NoneNoneAdstock alpha draws per channel. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
current_spenddict[str, Any] | NoneNoneCurrent spend per channel. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
segmentslist[dict[str, Any]] | NoneNoneAudience output segments {id, size} read by G-PRIV-01. Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
seed_tagstr | NoneNoneSeed label (Newton seed data). Written by models (registry.py, intake.py), planner, experiments and Newton’s seed.
reach_curvesdict[str, Any] | NoneNoneReach and frequency family profile curves (spec §16: reach curve, frequency, dedupe), carried beside the declared estimands. Written by notebook 12 through babelfin Model.from_table.
metric_familystr | NoneNoneLegacy top-level metric family (sales_return, brand_awareness, …); the estimand’s own metric_family is preferred. Read by G-EXP-05 (gates._calibration_target) and experiments calibrate.py.

Source: packages/ump-spec/src/ump_spec/models/model.py, line 225

function

def normalize_family(label: str | None) -> str

Canonical family for a label ("brand_funnel/track" -> "media_tracking").

Raises UmpError(SCHEMA_INVALID) for an unknown label. "experiment" is refused on purpose: experiment adapters declare adapter_kind="experiment" and the family their results calibrate.

Source: packages/ump-spec/src/ump_spec/models/model.py, line 69

function

def validity_instant(value: Any) -> datetime | None

A validity bound as a UTC instant (spec §4 time profile, §7 half-open window). A calendar date (2026-01-01 or a date) reads as midnight UTC; a naive datetime reads as UTC; an offset is converted. Anything unreadable (or empty) is None.

Source: packages/ump-spec/src/ump_spec/models/model.py, line 165

function

def validity_expired(valid_to: Any, now: datetime | None = None) -> bool

Spec §7: the window is half-open [valid_from, valid_to), so a model is expired when valid_to <= now. No (or an unreadable) valid_to never expires.

Source: packages/ump-spec/src/ump_spec/models/model.py, line 187

NameTypeValueDescription
TierLiteral['A', 'B', 'C', 'D', 'X']
TIERStuple[str, ...]('A', 'B', 'C', 'D', 'X')
TIER_NAMESdict[str, str]{'A': 'full model', 'B': 'curve parameters', 'C': 'spend table', 'D': 'summar...
ModelFamilyLiteral['media_mix', 'audience', 'reach_frequency', 'attribution', 'brand_fun...
MODEL_FAMILIEStuple[str, ...]('media_mix', 'audience', 'reach_frequency', 'attribution', 'brand_funnel', '...
FAMILY_NOTESdict[str, str]{'media_mix': 'Marketing mix models (spec §16 media mix profile): response cu...Plain words per family. Experiments are not a model family (see adapter.AdapterKind).
FAMILY_ALIASESdict[str, str]{'brand_funnel/track': 'media_tracking', 'mtm': 'media_tracking', 'media_trac...Labels seen in briefs and adapters mapped to the canonical ModelFamily value.
RepresentationLiteral['draws', 'quantiles', 'interval', 'point', 'moments', 'moments_cov']
DependenceKindLiteral['joint_draws', 'joint_gaussian', 'declared_assumption', 'per_channel'...
AcceptanceStatusValueLiteral['untested', 'pilot', 'passed', 'failed']
CapabilityStatusLiteral['sandbox', 'pilot', 'certified', 'restricted', 'withdrawn']
LayerNameLiteral['computation', 'identification', 'decisions']
ACCEPTANCE_LAYERStuple[str, ...]('computation', 'identification', 'decisions')
ValidityInstantAnnotated[datetime, BeforeValidator(_coerce_validity), PlainSerializer(_insta...