Repository navigation
Fix diff() erroring on NaN parameter values; fix vector diff comparing p1 to itself - #21
Merged
Merged
Conversation
equals_with_missing used ==, so two identical NaN parameter values (e.g. FUSE ActorSOLPSNN.Psol with default=NaN) made diff() error. Use isequal, which treats missing==missing and NaN==NaN as true, including inside arrays. Also fix a copy-paste bug in diff(::AbstractParametersVector, ...): v2 was read from p1 instead of p2, so vector diffs compared p1 against itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
|
Human @tomneiser, why does the test return |
Member
Author
|
Thanks, before being fed any data I made the actor return |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
FUSE CI (
test/runtests_study.jl) started failing after ProjectTorreyPines/FUSE.jl#1124 addedActorSOLPSNN.Psolwithdefault=NaN:diff()compares values throughequals_with_missing, which fell through toa == b. SinceNaN == NaNisfalse, two identical NaN values were reported as different anddifferrored.(FUSE side is independently fixed by ProjectTorreyPines/FUSE.jl#1138, which drops the NaN sentinel — this PR remains worthwhile as a robustness fix: parameter values can legitimately contain NaN, e.g. inside arrays.)
Fix
equals_with_missing(a, b) = isequal(a, b)—isequaltreatsmissing == missingandNaN == NaNas true (including inside arrays), and otherwise matches==.diff(::AbstractParametersVector, ...):v2was read fromp1instead ofp2, so vector-parameter diffs silently comparedp1against itself.Note on the
src/io.jlcall siteequals_with_missingis also used inpar2ystr'sskip_defaultssub-tree check. The scalar-parameter path below it already usesvalue === default, and for floats===treatsNaN === NaNas true and-0.0 === 0.0as false. The old==-based check diverged from that on exactly those two cases (an untouched NaN-defaulted parameter was wrongly considered "not default" and written out);isequalmatches===float semantics, so this change aligns the sub-tree check with the existing scalar check.Testing
Entrydiffs cleanly, real differences still throw, missing/NaN-array semantics correct.Pkg.test()suite passes.Version bump to be done after merge per repo convention.
🤖 Generated with Claude Code