Skip to content

introduce add_userdata() (#23) - #32

Merged
gvegayon merged 3 commits into
masterfrom
dmi3kmo/new_feat
Dec 9, 2025
Merged

gvegayon merged 3 commits into
masterfrom
dmi3kmo/new_feat

Conversation

@gvegayon

@gvegayon gvegayon commented Dec 9, 2025

Copy link
Copy Markdown
Member

No description provided.

* introduce add_userdata()

* Update R/mcmc_info.R

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update R/mcmc_info.R

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 9, 2025 07:09
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown

Thank you for your contribution @gvegayon 🚀! The pkgdown site preview is ready for review 👉 Download here 👈!
(The artifact expires on 2026-03-09T23:17:55Z. You can re-generate it by re-running the workflow here.)

@gvegayon

gvegayon commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

@copilot, can you add a test for the new function? You can use this file as a reference. For context, imagine you are an expert R programmer and Bayesian statistician. Keep the test simple, but also think about a couple of edge cases if possible. If needed, you can add caveats to the documentation using roxygen (and updating the Rd files using devtools::document()).

attn @dmi3kno

Copilot AI commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

@gvegayon I've opened a new pull request, #33, to work on those changes. Once the pull request is ready, I'll request review from you.

This comment was marked as outdated.

* Initial plan

* Add comprehensive tests for add_userdata() function

- Fixed add_userdata() to handle single chain mcmc objects
- Added examples to documentation with roxygen2
- Created 5 comprehensive test cases covering:
  * Basic single chain functionality
  * Multiple chain support
  * Data integrity verification
  * Error handling for mismatched chains
  * mcpar attribute preservation
- Updated NAMESPACE and documentation files

Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>

* Fix test-userdata.R: remove incorrect [[1]] indexing for single chain mcmc objects

Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>

* Address PR review comments

- Fix @PARAM x documentation to cover both ith_step() and add_userdata()
- Add important note that add_userdata() relies on most recent MCMC() call
- Rename combined_mcpar to combined_data for clarity in test
- Add comment explaining global state dependency in Test 4

Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
@gvegayon

gvegayon commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

OK @copilot, the CI is failing with the following error:

test-userdata.R...............   35 tests 1 fails 80ms

test_fmcmc.R..................    1 tests OK 1ms
----- FAILED[data]: test-userdata.R<186--186>
 call| expect_equal(actual_double, expected_double)
 diff| Mean relative difference: 0.5327946

Ensure you can run the test files and R CMD check before you submit the needed changes.

Copilot AI commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

@gvegayon I've opened a new pull request, #34, to work on those changes. Once the pull request is ready, I'll request review from you.

* Initial plan

* Fix test-userdata.R: compare against proposed values, not accepted values

The test was incorrectly comparing userdata stored during MCMC proposal evaluation
against the final accepted parameter values. Since set_userdata is called with the
proposed value p (not the accepted value), the test should compare against get_draws()
(proposed values) rather than the MCMC output (accepted values).

Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
@gvegayon

gvegayon commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

Test are passing. The Windows tests seem to be a bug related to the GHA to run R CMD check (I have experienced this before in other projects). Will leave that for later.

@gvegayon
gvegayon merged commit cc8349a into master Dec 9, 2025
11 of 14 checks passed
@gvegayon
gvegayon deleted the dmi3kmo/new_feat branch December 9, 2025 23:40
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.

4 participants