Skip to content
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

Add native SIR filter example #85

Merged
merged 5 commits into from
Oct 16, 2024
Merged

Add native SIR filter example #85

merged 5 commits into from
Oct 16, 2024

Conversation

richfitz
Copy link
Member

@richfitz richfitz commented Oct 15, 2024

This PR removes dust as a dependency and starts the exploration of a proper rng interface. There's quite a bit in here as a result. But the main thing that we're trying to do is to build a well-behaved stochastic model that can eventually unblock #68. I don't think that this has everything (you need grouped structure too, right @edknock?) but this gets us most of the way.

The monty_rng interface is not suitable for creating models because we can't use the streams in the same way as we do from dust. If we have n values in size and prob and n streams in rng_state I want to be able to do Binomial(size, prob, rng_state) and have the first stream use the first size and prob, the second stream use the second etc. This is not implemented in monty_rng and this means we have no way to draw random numbers in a way that we can build models that look like dust but without using it.

Here I've sketched out a couple of accessor functions (see the 2 files in both R/ and src/); these allow access in this way. Then we build a particle filter by hand (this is tedious and was done following the manual implementation in the dust2 helpers: https://github.com/mrc-ide/dust2/blob/main/tests/testthat/helper-dust.R#L5). With that I have managed to replace all the dust code and replaced it with this model.

The next step will be to make this work with multiple parameter sets, which I'll do in the next PR.

Merge after #84, contains those commits

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 97.72727% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.45%. Comparing base (ab2368f) to head (4f84a3c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/random2.cpp 97.22% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
- Coverage   99.46%   99.45%   -0.02%     
==========================================
  Files          64       66       +2     
  Lines        4889     4933      +44     
==========================================
+ Hits         4863     4906      +43     
- Misses         26       27       +1     

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

@richfitz richfitz requested a review from weshinsley October 15, 2024 11:15
@richfitz richfitz marked this pull request as ready for review October 15, 2024 11:15
Copy link
Contributor

@weshinsley weshinsley left a comment

Choose a reason for hiding this comment

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

Talked through yesterday - all looks good - and we'll mop up the coverage issues a bit later...

@weshinsley weshinsley merged commit e6e3d12 into main Oct 16, 2024
8 of 10 checks passed
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.

2 participants