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

Ficticious jump algorithm for time-dependent variable rate jumps. #252

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

Conversation

pihop
Copy link

@pihop pihop commented Jul 3, 2022

Extends the VariableRateJump interface to allow for user-defined bounds on time-dependent jump rates and look-ahead horizons for which the bound is valid. Implements a fictitious jump rejection algorithm based on https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1004923.

Relevant issue: #28

@coveralls
Copy link

coveralls commented Jul 3, 2022

Pull Request Test Coverage Report for Build 4127486574

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 66 of 68 (97.06%) changed or added relevant lines in 3 files are covered.
  • 14 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+1.5%) to 88.512%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/jumps.jl 9 11 81.82%
Files with Coverage Reduction New Missed Lines %
src/aggregators/aggregated_api.jl 4 77.27%
src/jumps.jl 10 84.39%
Totals Coverage Status
Change from base Build 3856869287: 1.5%
Covered Lines: 2165
Relevant Lines: 2446

💛 - Coveralls

@isaacsas
Copy link
Member

isaacsas commented Jul 4, 2022

@pihop still taking a look over this -- I've been delayed by the US holiday and travel for it. One quick comment is it would be great if you could add a test that actually tests accuracy by comparing some statistic against simulations using the current approach.

@isaacsas
Copy link
Member

@pihop looks like tests are passing now. Please let me know when you feel this is done and you have added an accuracy test that compares against the current solvers (to check you are getting the correct statistics on some simple example like A+B -> C). I'll then go through and give it a review. Thanks!!!

Copy link
Member

@isaacsas isaacsas left a comment

Choose a reason for hiding this comment

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

It would be good to add this to the Hawkes test too and make sure that passes, but the bigger thing to address is that this doesn't seem to actually implement Extrande to me (based on the pseudo-code in Box 1 of the PLOS Comp Bio paper).

If you are trying to implement a different method that is fine, but we shouldn't call this Extrande then, and should reference the relevant paper.

src/aggregators/aggregators.jl Outdated Show resolved Hide resolved
src/aggregators/extrande.jl Outdated Show resolved Hide resolved
src/aggregators/extrande.jl Outdated Show resolved Hide resolved
src/aggregators/extrande.jl Outdated Show resolved Hide resolved
src/aggregators/extrande.jl Outdated Show resolved Hide resolved
Copy link
Member

@isaacsas isaacsas left a comment

Choose a reason for hiding this comment

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

You need to update next_extrande_jump to handle MassActionJumps too, see how we do it in Direct.jl. They work differently than ConstantRateJumps or VariableRateJumps.

Please also add extrande to some of the tests for constant rate problems so we can make sure it is working ok there too.


# Calculate the total rate bound and the largest common validity window.
if !isempty(p.rate_bnds)
Bmax = typeof(t)(0.)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Bmax = typeof(t)(0.)
Bmax = zero(t)

ma_jumps, save_positions, rng; variable_jumps = (), kwargs...)
ma_jumps_ = !isnothing(ma_jumps) ? ma_jumps : ()
rates, affects! = get_jump_info_fwrappers(u, p, t,
(constant_jumps..., variable_jumps..., ma_jumps_...,
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't make sense as MassActionJumps don't use the same interface as ConstantRateJumps or VariableRateJumps. So while you can merge the rate functions from the latter two you need to keep track of MassActionJumps separately and handle their rate calculation separately. See what we do in Direct for handling them.

@isaacsas
Copy link
Member

isaacsas commented Feb 7, 2023

Looks like a real CI failure.

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