Skip to content

Exp Overflow Warning #123

@sjenkins20

Description

@sjenkins20

Following an upgrade to use Python 3.11 and numpy 2.0.0, we've been getting some odd results from the influenza like illness model. Other associated packages were upgraded too and a list can be provided. We believe in one of these packages, warning supression has been changed and as a result, we are now receiving warnings we previously weren't and the effects of the issues are now being observed.

In this instance, we are seeing large spikes in the population outputs. The associated warning when this occurs is an overflow warning for exp. We have narrowed this down to the calculation of expressions of the form 1/(exp(x)+1), where the value of x is becoming larger than exp can handle. In this instance, expit is a good solution https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.expit.html

However, the solution requires that _model_verification.py be updated to allow the model Transitions, defined as strings, to interpret expit and utilise it. This requires that expit be passed the inputs as an array and we are unsure how to formulate this in a Transition string, or if this needs adding to the implementation. We have a temporary solution in place, but I think others would benefit from the use of expit too.

There are also other models in pygom that use this formulation, but we are not seeing the issue there currently, but it would be good to use expit here too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions