Allow fixed entries in probability constraints#683
Open
hmgaudecker wants to merge 3 commits intomainfrom
Open
Conversation
Consolidate fixed-at-zero entries out of a ProbabilityConstraint before the kernel transformation runs, so a FixedConstraint pinning some selected entries to 0.0 can coexist with a ProbabilityConstraint on the same parameters. The zero-fixed entries are driven by the existing fixed-value pipeline; the remaining free entries form a simplex summing to one. Fixes to values other than 0.0 still raise InvalidConstraintError; that generalisation is left for a follow-up commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Generalise the zero-fix fold: any fix in [0, 1) whose sum over the selector is strictly less than 1 is accepted. The fold attaches sum_target = 1 - sum(fixed_values) to the transformation dict, and probability_from_internal and its Jacobian scale by sum_target. The pure zero-fix path is unchanged (sum_target key omitted, semantics identical to the no-fix path). probability_to_internal stays untouched because x / x[-1] is scale invariant; the internal pivot is still 1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The zero-fix and non-zero-fix changes ship together in one PR; one bullet describes the end-state behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
In an application, I need probability constraints where one element is fixed. This is currently rejected by optimagic; this PR fixes that.