Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the physical realism of the PowerModelMethod by clipping counterfactual power predictions to a plausible range, and extends the study_power_model_compare workflow with an objective per-bin before/after view against the committed benchmark.
Changes:
- Add prediction clipping in
PowerModelMethodusing a requiredbaseline_rated_power_kwceiling/floor policy, and update callers/tests accordingly. - Add a “conditional before/after” report to
study_power_model_compare(CSV + overlay plots) that reconstructs the benchmark per-bin estimate from stored bias and compares per-bin|bias|changes with a shared materiality band. - Expose Hill of Towie baseline rated power as
HOT_RATED_POWER_KWfor consistent configuration across scripts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/benchmarking/baselines/test_study_power_model_compare.py | Adds unit/integration-style tests for the new conditional before/after table/overlay/tally behaviors and file outputs. |
| tests/benchmarking/baselines/test_power_model_method.py | Updates PowerModelMethod construction with baseline_rated_power_kw and adds focused tests for _clip_predictions. |
| benchmarking/synthetic/sources/hill_of_towie.py | Defines HOT_RATED_POWER_KW constant for Hill of Towie synthetic turbines. |
| benchmarking/synthetic/init.py | Re-exports HOT_RATED_POWER_KW for convenient imports and adds it to __all__. |
| benchmarking/baselines/study_power_model_compare.py | Introduces shared materiality band, per-bin before/after table + overlay frame, and wires the new report into main(). |
| benchmarking/baselines/power_model/method.py | Implements _clip_predictions, adds required baseline_rated_power_kw, and applies clipping to upgraded and validation predictions. |
| benchmarking/baselines/power_model/diagnostics.py | Formatting-only adjustments (no behavior change). |
| benchmarking/baselines/inspect_prepost_hard_case.py | Passes baseline_rated_power_kw into PowerModelMethod using HOT_RATED_POWER_KW. |
| benchmarking/baselines/example_toggle_study.py | Passes baseline_rated_power_kw into PowerModelMethod using HOT_RATED_POWER_KW. |
| benchmarking/baselines/example_prepost_study.py | Passes baseline_rated_power_kw into PowerModelMethod using HOT_RATED_POWER_KW. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if schema != _BASELINE_SCHEMA: | ||
| msg = f"candidate {candidate_path} has schema {schema!r}, expected {_BASELINE_SCHEMA!r}; regenerate it." | ||
| raise ValueError(msg) | ||
| baseline_path.write_text(text) |
Comment on lines
+591
to
+592
| n_cells = int(merged[_METRIC_COLS].notna().all(axis=1).sum()) | ||
|
|
||
| def tally(delta: pd.Series) -> str: | ||
| """Count cells that moved beyond the noise floor: ``better`` (down) vs ``worse`` (up).""" | ||
| better = int((delta < -_IMPROVE_EPS).sum()) | ||
| worse = int((delta > _IMPROVE_EPS).sum()) | ||
| return f"{better} better / {worse} worse (of {n_cells})" | ||
| threshold = _MATERIAL_PP / _PP # tally works on fractional deltas; the band is defined in pp. |
Comment on lines
+412
to
+414
| # Baseline rated power of the Hill of Towie test turbines (kW); matches the synthetic generator's | ||
| # baseline ``rated_power_kw`` default and caps the power-model counterfactual predictions. | ||
| HOT_RATED_POWER_KW = 2300.0 |
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.
Add a minor improvement to power_model: clip predicted power to physically realistic range.
Improve comparison script to be able to evaluate improvements to power_model objectively.