Skip to content

Removed unused fft function and relying on posterior #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

VisruthSK
Copy link
Collaborator

@VisruthSK VisruthSK commented Jun 12, 2025

One test was failing due to minor numerical differences in algorithms: average diff: 0.00975, largest diff: 0.01472. I updated the expected test result at reference-results/relative_eff.rds.

posterior::autovariance is already used.

Starts work on #249

@VisruthSK VisruthSK linked an issue Jun 12, 2025 that may be closed by this pull request
Copy link
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

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

Seems like it should be fine to make this change. There are additional tests failing due to differences with the saved reference objects. They seem small, but would be good for @avehtari to confirm that these differences are reasonable to expect due to (I assume) minor differences between this older ESS code and the ESS algorithm used in posterior.

@avehtari
Copy link
Member

Differences in ESS with magnitude in order of 1e-2 are small and can be ignored.

Instead of posterior::ess_basic(), I would use posterior::ess_mean() as the name makes it more explicit what is computed. They use the same approach (but ess_basic() allows also additional argument which can be used to turn off the splitting).

@VisruthSK
Copy link
Collaborator Author

Is there a neat way to update all expected outputs to the new values so that tests pass?

@jgabry
Copy link
Member

jgabry commented Jun 13, 2025

I think if we updated to using the newer testthat::expect_snapshot() then there's a way to update all of them at one. The older expect_equal_to_reference() doesn't seem to have that ability unfortunately. At some point we should update to snapshot testing (it wasn't part of testthat when I wrote these tests a long time ago).

If you want to do that as part of this PR we could, but also fine to hold off on that and just update the reference files.

@jgabry
Copy link
Member

jgabry commented Jun 13, 2025

If you don't want to update to snapshot testing then I think the east way might be to just delete the out of date reference files and then run the tests locally on your local machine and it should generate new files. But I think you need to run the tests interactively for it to generate the new files. That is, you can't just do devtools::test(), you need to open the relevant test file and run all the tests (you can run all of them, you don't need to do it one by one).

@VisruthSK
Copy link
Collaborator Author

I think swapping to snapshots is worthwhile, so I'll get started on that. It'll make this PR easier so might as well include it here. I briefly tried updating the reference files but I wasn't able to get the reference files to update easily.

@avehtari
Copy link
Member

Looks good to me.

I assume you update only the snapshots if the differences were small? And in case of big differences, investigate the reason first?

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.

3 participants