Repository navigation
Conversation
…eters Infinite or NaN entries in a user provided derivative with respect to fixed parameters spread to the complete internal derivative, because they were multiplied with the zero rows of the reparametrization Jacobian. These entries are now set to zero before the multiplication. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
A user provided derivative that is infinite or NaN for a fixed parameter made the optimization fail, even though that entry cannot influence the optimization. This was found while discussing this review comment by @hmgaudecker on #727 (point 2), which assumed that such entries are ignored.
Cause. With constraints, the external derivative is multiplied with the Jacobian of the reparametrization. The rows of that Jacobian that belong to fixed parameters are zero, but
nan * 0andinf * 0arenan, so one non-finite entry made the complete internal derivativenan.Fix. The converter now determines once which external parameters depend on at least one internal parameter, and sets the derivative entries of all other parameters to zero before the multiplication. This covers fixed parameters and parameters that are equal to a fixed parameter. The dependence is determined from the structure of the reparametrization, not from Jacobian values. All parameters of a transforming constraint count as dependent, so non-finite entries there still raise.
Behavior changes
minimizeandmaximizeraised aUserFunctionRuntimeErrorat the first derivative evaluation. Non-finite entries for all other parameters raise as before.Relation to #727
The start params check in #727 uses the same conversion, so it also ignores these entries once this PR is merged. The test requested there (
nanin the derivative of a fixed parameter does not raise) needs this PR first.nanin the derivative of a fixed parameter does not raise in the start params check. It goes into whichever PR is merged second.🤖 Generated with Claude Code