Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the served
v5envelope. Aconditionrequest no longer carries oneConditionBlockpinned to a single future position. EachEqualityCondition/IntervalConditionnow names the positions it covers through its ownquery_time_indices, andNonecovers every entry ofquery_times. A v5 deployment comparesschema_versionfor exact equality before any other validation. So this client must be released before any deployment servesv5, because the released0.8.0would be refused on every request,forecastincluded.This branch also carries the unreleased work already on
main(#17: thelog_probreturn mode, answering every declared column by default). Releasing it gives0.9.0, which the examples repo already declares as its floor.Breaking changes
ConditionBlockis removed.condition=now takes oneCondition(EqualityCondition | IntervalCondition) or a sequence of them, onforecast,forecast_mean,forecast_samples,forecast_quantilesandforecast_log_prob.SCHEMA_VERSIONis now"v5". The wire fieldcondition: {query_time_index, conditions}is replaced by a top-levelconditionslist, and each entry carriesquery_time_indices.resolve_conditionsis now exported. It normalizes one condition or a sequence and rejects two conditions on one column at a shared position.Migration:
Behavior
query_times. A position no condition covers carries the unconditioned forecast, which is exact because the deployment draws positions independently.log_probquestion.plausibilitynumbers are summed across covered positions. At each position,region_log_probabilityis conditional on that position's pinned values, so the two numbers add up to the plausibility of the whole condition set.diagnostics.interval_estimatorappears when some position bounds more than one column. Across several estimated positions it describes the one with the smallest effective sample size.Docs and notebooks
README,
docs/api-reference.mdandnotebooks/forecast_condition.ipynbnow describe the per-position contract. The plausibility-chain wording fromstefan/conditioningwas dropped when that branch was merged into this one, and is restored here.Verification
task pre-commitpasses: ruff, ty, typos, and the full test suite with coverage.joint.model.service.conditions.parse_conditions) parses every v5 request fixture intests/fixtures/, and each fixture'sschema_versionequals the server'sDEFAULT_SCHEMA_VERSION.v5deployment.Note
High Risk
Breaking contract change (v4 → v5, removed
ConditionBlock, new request/response conditioning semantics) affects all forecast and condition callers; misaligned deployments or unmigrated clients will fail compatibility checks or parse errors.Overview
This PR moves the JointFM Python SDK to schema v5 and reshapes how conditional forecasts are expressed and returned.
Breaking API change:
ConditionBlockis removed.condition=on forecast helpers now accepts oneEqualityConditionorIntervalCondition, or a list of them. Each condition carriesquery_time_indices(indices intoquery_times;Nonemeans all horizons). The wire payload uses a top-levelconditionsarray instead ofcondition: { query_time_index, conditions }.resolve_conditionsis exported to normalize and validate lists (including rejecting overlapping conditions on the same column at the same position).Behavior: Condition responses still include every
query_timesentry; horizons without a covering condition get the unconditional forecast. Validation andrequire_condition_supportfollow the new shape; plausibility and interval-estimator semantics are documented as multi-position (sums across independent positions).Config/docs: Samples, README, API reference, and the conditional forecast notebook are updated for v5 and the new conditioning model. Tests and JSON fixtures reflect v5 schema and full-horizon condition responses.
Reviewed by Cursor Bugbot for commit 0c1df59. Configure here.