Skip to content

Clipping fix to underflow.#288

Open
Averydx wants to merge 3 commits into2.0-betafrom
277-overflow-in-exponent-when-calculating-movement-model
Open

Clipping fix to underflow.#288
Averydx wants to merge 3 commits into2.0-betafrom
277-overflow-in-exponent-when-calculating-movement-model

Conversation

@Averydx
Copy link
Copy Markdown

@Averydx Averydx commented Mar 30, 2026

Fixes the associated issue with probability of movement underflowing in mm.centroids. Probability of movement is now clamped to a minimum of $e^{-100} \approx 2.68 \times 10^{-43}$. This is close enough to zero that it shouldn't affect any simulation results. We should put a warning in the docs that mm.centroids is not well suited to the state level spatial scale.

@Averydx Averydx requested a review from JavadocMD March 30, 2026 23:15
@Averydx
Copy link
Copy Markdown
Author

Averydx commented Mar 30, 2026

It may be better to throw an error here, except there could be cases where some nodes are geographically close and others are very far away. Then this is the preferred solution, as movement being close to zero is intended behavior. Think mainland US vs Hawaii.

@JavadocMD
Copy link
Copy Markdown
Contributor

Alternatively we could make it a Centroids argument for how to deal with errors, with clipping as the default behavior. Not entirely dissimilar from the way you can specify how the CDC ADRIOs recover when there's missing or sentinel data.

rume = SingleStrataRUME.build(
  ...
  mm=mm.Centroids(fix_underflow="clip"), # default
  ...
)

The other option that comes to mind being "raise" for raising an error if it happens.

Suggest bringing this up with the group for comment.

@JavadocMD
Copy link
Copy Markdown
Contributor

It would be really nice to have a battery of tests for Centroids as well. I don't think we have tests for any of the MMs yet... not easy to test stochastic things; but we might be able to test the dispersal_kernel property easily enough.

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