Allow structured parameter containers in ParamsWithStats#212
Merged
Conversation
Contributor
|
AbstractMCMC.jl documentation for PR #212 is available at: |
The final assertion in the Equality testset used NaN-containing params, so the params term already forced `==` to false regardless of extras — it never actually tested that a differing field makes two wrappers unequal. Replace it with a NaN-free comparison plus a matching equal case, and normalise `==` formatting to blue style. Co-Authored-By: Claude Code <noreply@anthropic.com>
yebai
reviewed
Jul 21, 2026
…only The wrapper keeps the default struct equality it had before this branch, so the parameter container only needs to implement pairs and isempty. Tests now use a VarName-like stand-in (StructuredKey/StructuredParams) with non-Symbol keys and cover mixed-key iteration, NameFilter on stringified keys, and container preservation through the extraction constructor.
Merge the overlapping structured-params testsets, drop the StructuredState wrapper by letting the container act as its own state, and simplify StructuredParams to a concrete field. Same code paths covered with one setup per testset.
Member
Author
|
This should allow us to start trying to use |
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.
ParamsWithStatsrequiredparamsto be aNamedTuple, so parameter containers with non-Symbolkeys could not be stored without lossy conversion. This PR relaxes the struct toParamsWithStats{P,S<:NamedTuple,E<:NamedTuple}: the parameter container can be any type implementingpairsandisempty, with keys that have a meaningful string form so name-based filtering and logging work. It also adds a two-argument constructorParamsWithStats(params, stats)(emptyextras) and documents thatpairs(pws)may yield mixed key types, so consumers should iterate generically.This is intended to be non-breaking: existing constructors and the
Vector{<:Real}/Vector{<:Pair}normalizations are unchanged, and equality keeps the default struct behavior. Bumps the version to 5.16.0.