Skip to content

ump_workflow.answers

module ump-workflow

Answers from per-draw values: point, interval and the estimand, with horizons recomputed from the data.

A question (questions.json) is {name, ask, function, estimand, horizon_from?, summary_ref?, fit_estimand?}. estimand is a seven-field template; horizon_from (rows or periods) sets horizon.weeks from the input on every run (never frozen at save) and the scope’s applies_to.period from the time column; summary_ref ({metric: roi|mroi, channel}) names the question’s Tier D number in summary.json; fit_estimand (set at save for those questions) is the fit-time estimand a summary answer carries, so two questions on one metric keep their own scope. The interval is the quantiles of the draws at the estimand’s level; with no level declared the level is 0.9, labelled proposed.

function

def check_questions(questions: list[dict[str, Any]]) -> list[dict[str, Any]]

Validate the question list (unique names, identifier functions, a valid estimand template).

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 28

function

def estimand_for(
q: dict[str, Any],
df: pd.DataFrame,
contract: InputContract,
) -> dict[str, Any]

The question’s estimand on this input: horizon and period derived from the data when asked.

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 54

function

def answer(
q: dict[str, Any],
draws: np.ndarray,
df: pd.DataFrame,
contract: InputContract,
) -> dict[str, Any]

{value, lo, hi, level, draws_summary, estimand, proposed} for one question’s draws.

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 71

function

def build_summary(
*,
name: str,
engine: str,
questions: list[dict[str, Any]],
answers: dict[str, dict[str, Any]],
dependence: str | dict[str, Any] | None,
) -> dict[str, Any]

A Tier D model_manifest doc of the fit-time answers that have a summary_ref.

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 89

function

def with_fit_estimands(
questions: list[dict[str, Any]],
answers: dict[str, dict[str, Any]],
) -> list[dict[str, Any]]

The questions with fit_estimand (the fit-time answer’s estimand) on each one the summary holds a number for: a summary answer then keeps its own seven-field estimand, never another question’s on the same metric.

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 115

function

def summary_answers(
questions: list[dict[str, Any]],
summary: dict[str, Any],
) -> tuple[dict[str, dict[str, Any]], list[str]]

Answers read from the Tier D summary, and the questions it holds no number for. Each answer carries its own question’s estimand (fit_estimand, else its template), never the summary’s per-metric one.

Source: packages/ump-workflow/src/ump_workflow/answers.py, line 131

NameTypeValueDescription
DEFAULT_LEVEL0.9
HORIZON_FROM(None, 'rows', 'periods')