Skip to content

Warn and skip constant parameter groups in all update strategies#13694

Merged
larsevj merged 1 commit into
equinor:mainfrom
larsevj:handle_constant_params_in_adaptive_localizations
Jun 4, 2026
Merged

Warn and skip constant parameter groups in all update strategies#13694
larsevj merged 1 commit into
equinor:mainfrom
larsevj:handle_constant_params_in_adaptive_localizations

Conversation

@larsevj
Copy link
Copy Markdown
Collaborator

@larsevj larsevj commented Jun 3, 2026

Issue
Resolves #13695

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

@larsevj larsevj force-pushed the handle_constant_params_in_adaptive_localizations branch from 9475101 to 4aab629 Compare June 3, 2026 10:19
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.56%. Comparing base (cb1a099) to head (a0796af).

Files with missing lines Patch % Lines
src/ert/analysis/_update_strategies/_adaptive.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13694      +/-   ##
==========================================
- Coverage   89.58%   89.56%   -0.02%     
==========================================
  Files         469      469              
  Lines       33419    33427       +8     
==========================================
+ Hits        29938    29939       +1     
- Misses       3481     3488       +7     
Flag Coverage Δ
cli-tests 35.77% <25.00%> (-0.01%) ⬇️
fuzz 43.36% <12.50%> (-0.01%) ⬇️
gui-tests 59.25% <25.00%> (-0.01%) ⬇️
performance-and-unit-tests 77.79% <87.50%> (-0.01%) ⬇️
test 45.53% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/ert/analysis/_es_update.py 93.98% <100.00%> (+0.28%) ⬆️
src/ert/analysis/_update_strategies/_adaptive.py 96.00% <50.00%> (-1.92%) ⬇️

... and 2 files with indirect coverage changes

@larsevj larsevj self-assigned this Jun 3, 2026
@larsevj larsevj added release-notes:bug-fix Automatically categorise as bug fix in release notes backport version-22.0 labels Jun 3, 2026
@larsevj larsevj force-pushed the handle_constant_params_in_adaptive_localizations branch from 4aab629 to a0796af Compare June 3, 2026 10:48
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 3, 2026

Merging this PR will not alter performance

✅ 36 untouched benchmarks


Comparing larsevj:handle_constant_params_in_adaptive_localizations (a0796af) with main (cb1a099)

Open in CodSpeed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses failures in ensemble updates when a parameter group is constant (zero variance across realizations) by explicitly detecting that condition, warning, and skipping the update while carrying the parameters over unchanged. This fits into ERT’s analysis update pipeline (_es_update + per-strategy implementations) by preventing update strategies from being invoked with empty/invalid parameter selections.

Changes:

  • Add an early-exit in perform_ensemble_update to warn, emit a status event, and copy parameters unchanged when an entire parameter group has zero variance.
  • Harden the adaptive localization strategy to skip assimilation for batches where all parameters are zero-variance (empty update set).
  • Add a regression unit test asserting a warning is logged and the posterior parameters equal the prior for constant parameters (for both global and adaptive strategies on GenKwConfig).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/ert/unit_tests/analysis/test_es_update.py Adds regression test ensuring constant parameter groups are warned about and carried over unchanged (adaptive/global for GenKw).
src/ert/analysis/_update_strategies/_adaptive.py Skips adaptive assimilation for batches where zero-variance filtering yields an empty update set.
src/ert/analysis/_es_update.py Warns and skips updates when all parameters in a group have zero variance; carries them over unchanged to the posterior.

Copy link
Copy Markdown
Contributor

@berland berland left a comment

Choose a reason for hiding this comment

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

Looks good

@larsevj larsevj merged commit 392fc20 into equinor:main Jun 4, 2026
40 of 41 checks passed
@larsevj larsevj deleted the handle_constant_params_in_adaptive_localizations branch June 4, 2026 06:42
@scout-team-app
Copy link
Copy Markdown

scout-team-app Bot commented Jun 4, 2026

Successfully created backport PR for version-22.0:

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

Labels

backport version-22.0 release-notes:bug-fix Automatically categorise as bug fix in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adaptive localization fails on a constant parameter

4 participants