Skip to content

Conditioning examples - #16

Merged
shackmann merged 1 commit into
mainfrom
stefan/conditioning
Sep 22, 2026
Merged

shackmann merged 1 commit into
mainfrom
stefan/conditioning

Conversation

@shackmann

@shackmann shackmann commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Introduces a new public forecast return mode and stricter response parsing on the core contract path; behavior is well covered by tests but mistakes in validation or parsing would affect all log-prob callers.

Overview
Adds first-class log_prob scoring: JointFMClient.forecast_log_prob(...) takes query_rows (one observed row per query_times) and returns LogProbResult / LogProbScores, with ForecastRequest enforcing that return_mode="log_prob" and query_rows stay paired and that requested_columns lists every readable column in schema order (pinned equality columns excepted).

Request building and adapters accept query_rows (DataFrame encoding reuses history row conversion with query_rows[...] error paths). Response parsing adds outputs.log_prob, recomputes summary fields from per-horizon values, and refuses unknown return_modes instead of mis-reading another mode’s shape. ConditionPlausibility docs clarify joint densities and how equality and region plausibility chain.

notebooks/forecast_condition.ipynb grows into a full conditioning walkthrough: unconditional vs conditional means, joint samples, quantiles inside bands, multi-interval box estimation, rally ranking via log-density differences, and conditional forecast_log_prob for comparing outcomes. README and docs/api-reference.md document the helper and wire fields; fixtures and tests/test_log_prob_mode.py cover validation and client round-trips.

Reviewed by Cursor Bugbot for commit 87f66ac. Configure here.

@shackmann
shackmann merged commit fefc75a into main Sep 22, 2026
2 checks passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 87f66ac. Configure here.

return dataframe_to_history_rows(query_rows, schema, field="query_rows")
return [dict(row) for row in query_rows]


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrays helper cannot score log_prob

Low Severity

build_forecast_payload_from_arrays still accepts return_mode="log_prob" but has no query_rows argument, so the new request check that log_prob and query_rows must appear together now rejects every arrays-built scoring payload. Callers who previously built the payload here and attached query_rows afterward can no longer get a payload back.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 87f66ac. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant