Skip to content

Internals to NamedTuple#54

Merged
rsenne merged 4 commits into
mainfrom
Internals-to-NamedTuple
Jul 1, 2026
Merged

Internals to NamedTuple#54
rsenne merged 4 commits into
mainfrom
Internals-to-NamedTuple

Conversation

@rsenne

@rsenne rsenne commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Changes Internals to a NamedTuple as recommended in #44 before being passed to a FlexiChain.

Resolves #49

Copilot AI review requested due to automatic review settings July 1, 2026 12:44
@rsenne

rsenne commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

@penelopeysm can i get a review here?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates how sampler internals are represented when constructing FlexiChains.FlexiChain outputs: internals are now passed as a NamedTuple (instead of being appended into a single numeric matrix), preserving natural element types like Bool and aligning numeric storage with the sampler’s working precision.

Changes:

  • Switch internals collection (logp, accepted, step_size, is_warmup) from stacked Matrix{Float64} to a NamedTuple of typed vectors.
  • Make chain numeric element types follow sampler precision (e.g., Float32 sampler yields Float32 chain columns).
  • Update tests to assert Bool-typed internals and add OrderedCollections dependency for ordered data storage.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/test-Adaptive-MALA.jl Updates assertions to expect Bool for accepted/is_warmup.
test/test-AbstractMCMC-Interface.jl Adds coverage for sampler precision propagation and Bool internals.
src/ParallelMCMC.jl Imports OrderedDict to support ordered per-key data construction.
src/interface.jl Core refactor: build FlexiChain from vals + internals::NamedTuple, preserve types, and follow sampler precision.
Project.toml Adds OrderedCollections to [deps] and [compat].
ext/DynamicPPLExt.jl Updates extension method to consume internals::NamedTuple and reconstruct stats per-sample.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/interface.jl Outdated
Comment thread src/interface.jl
"param_names consume $(offset - 1) columns, but there are $D parameter columns"
),
)
return FlexiChains.FlexiChain{TKey}(arr, all_names)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mmmh this kind of sucks but I see why you had to do it.

Are the parameters always guaranteed to be of the same type (f32 or f64 or whatever)? If so, it might be easier to construct two separate chains, one for the params (using the existing from-Array constructor) and one for the extras, and then merge them.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

How about now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes that looks great, you can also move the isempty check on L654 to before the OrderedDict construction :)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ah yes great point!

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.22%. Comparing base (1d13aa6) to head (e0d34a0).

❌ Your project check has failed because the head coverage (82.22%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
+ Coverage   82.05%   82.22%   +0.16%     
==========================================
  Files           8        8              
  Lines        1159     1170      +11     
==========================================
+ Hits          951      962      +11     
  Misses        208      208              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rsenne rsenne merged commit af1aed1 into main Jul 1, 2026
5 of 6 checks passed
@rsenne rsenne deleted the Internals-to-NamedTuple branch July 1, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make internals a NamedTuple

3 participants