Skip to content

Enforce prior belief-time constraint on forecasting pipeline input data#2016

Open
Copilot wants to merge 3 commits intofeat/forecasting-belief-timefrom
copilot/create-test-case-for-pr
Open

Enforce prior belief-time constraint on forecasting pipeline input data#2016
Copilot wants to merge 3 commits intofeat/forecasting-belief-timefrom
copilot/create-test-case-for-pr

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

The prior parameter was only tagging saved forecasts with the specified belief time (save_belief_time) but was not actually filtering which beliefs were loaded as training/prediction input. Only future-regressor beliefs were partially filtered in split_data_all_beliefs; the target sensor and past regressors used the most recent available belief regardless of prior.

Changes

Implementation

  • ForecasterParametersSchema.resolve_config: Exposes beliefs_before=data.get("belief_time") in the returned params dict — None when prior is absent, the explicit prior value otherwise.
  • BasePipeline: Adds beliefs_before parameter; passes it to sensor.search_beliefs() in load_data_all_beliefs(), restricting all sensor inputs (target, past regressors, future regressors) to beliefs recorded at or before prior.
  • TrainPipeline / PredictPipeline: Thread beliefs_before through to BasePipeline.
  • TrainPredictPipeline.run_cycle: Passes self._parameters.get("beliefs_before") to both sub-pipelines.

Test

  • New fixture setup_fresh_test_forecast_data_with_anomalous_beliefs: creates a sensor with two belief layers for the same events:
    • Phase 1 — normal values (50 kW), belief_time = 2024-12-31
    • Phase 2 — anomalous values (5000 kW), belief_time = 2025-01-10
  • test_prior_restricts_training_beliefs: runs the pipeline twice — once with prior before Jan 10 (model sees only normal data → low forecasts) and once with prior after Jan 10 (model sees anomalous data → high forecasts) — asserting the two outcomes differ by at least 10×.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@read-the-docs-community
Copy link

read-the-docs-community bot commented Mar 10, 2026

Documentation build overview

📚 flexmeasures | 🛠️ Build #31750889 | 📁 Comparing b329d2b against latest (c6bb60f)


🔍 Preview build

Show files changed (27 files in total): 📝 25 modified | ➕ 2 added | ➖ 0 deleted
File Status
changelog.html 📝 modified
genindex.html 📝 modified
py-modindex.html 📝 modified
_autodoc/COMMITMENTS.html 📝 modified
_autodoc/STATE_OF_CHARGE.html 📝 modified
_autosummary/flexmeasures.api.common.schemas.sensors.html 📝 modified
_autosummary/flexmeasures.api.common.utils.validators.html 📝 modified
_autosummary/flexmeasures.api.v3_0.sensors.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.base.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.predict.html 📝 modified
_autosummary/flexmeasures.data.models.forecasting.pipelines.train.html 📝 modified
_autosummary/flexmeasures.data.models.planning.battery.html ➕ added
_autosummary/flexmeasures.data.models.planning.charging_station.html ➕ added
_autosummary/flexmeasures.data.models.planning.html 📝 modified
_autosummary/flexmeasures.data.models.planning.storage.html 📝 modified
_autosummary/flexmeasures.data.schemas.scheduling.html 📝 modified
_autosummary/flexmeasures.data.schemas.sensors.html 📝 modified
_autosummary/flexmeasures.data.schemas.units.html 📝 modified
_autosummary/flexmeasures.ui.error_handlers.html 📝 modified
_autosummary/flexmeasures.utils.doc_utils.html 📝 modified
api/change_log.html 📝 modified
api/notation.html 📝 modified
api/v3_0.html 📝 modified
cli/change_log.html 📝 modified
concepts/data-model.html 📝 modified
features/scheduling.html 📝 modified
tut/toy-example-reporter.html 📝 modified

… schema

Co-authored-by: BelhsanHmida <149331360+BelhsanHmida@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test case for pull request test: add test cases for prior (belief_time) parameter in forecasting schema Mar 10, 2026
Copilot stopped work on behalf of BelhsanHmida due to an error March 10, 2026 22:49
…straint

Co-authored-by: BelhsanHmida <149331360+BelhsanHmida@users.noreply.github.com>
Copilot AI changed the title test: add test cases for prior (belief_time) parameter in forecasting schema Enforce prior belief-time constraint on forecasting pipeline input data Mar 10, 2026
@BelhsanHmida BelhsanHmida marked this pull request as ready for review March 12, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants